Babel Preset Cozy App

npm version license npm downloads david-dm renovate

What’s babel-preset-cozy-app?

A shareable configuration for Cozy Applications or Scripts.

This package is a Babel preset already used by create-cozy-app.

To install:

yarn add --dev babel-preset-cozy-app

Usage with a Create Cozy App projects

If you started your project using create-cozy-app, you don’t need to do anything, you should already have a .babelrc configured to used this preset.

Usage with other projects

If you want to use this preset, you first need to have Babel installed (cf documentation).

Then, in a file named .babelrc (the Babel configuration file), you can use the preset using the following way:

{
    "presets": ["cozy-app"]
}

Options

node (boolean): false by default

By default, this babel preset targets browsers but you can target node by using the node option:

{
    "presets": [
        ["cozy-app", {
            "node": true
        }]
    ]
}

react (boolean): true by default

By default, this babel preset uses the react preset (babel-preset-react) but you can disable this behaviour with the react option to false as following:

{
    "presets": [
        ["cozy-app", {
            "react": false
        }]
    ]
}

transformRegenerator (boolean): true by default (for browsers only)

By default, this babel preset uses babel-plugin-transform-runtime to transform regenerator functions on the runtime. But sometimes (not always) it could break CSPs due to some eval usage so you can disable this behaviour with the transformRegenerator option to false as following:

{
    "presets": [
        ["cozy-app", {
            "transformRegenerator": false
        }]
    ]
}

Community

What’s Cozy?

cozy


Cozy is a platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one’s tracking you.

Get in touch

You can reach the Cozy Community by:

License

babel-preset-cozy-app is distributed under the MIT license.