Babel-Preset-Quick-Brick
This Babel preset allows to easily set up the babel config for any quick brick app or plugin.
It can be used on web as well as react-native
how to use
- install the dependency
yarn add --dev @applicaster/babel-preset-quick-brick
- in your .babelrc file or in your weback config, add the preset
// .babelrc
{
presets: ["@applicaster/quick-brick", { env: /* ... */, platform: "web" }]
}
// webpack.config.js
...
{
module: {
rules: [
{
test: /(.js|.jsx)$/,
loader: "babel-loader",
exclude: /node_modules/
options: {
presets: [
["applicaster/quick-brick", { env: envOptions, platform: platformOptions }],
]
}
}
]
}
}
...
Options
-
env: Object to be passed to @babel/preset-env
-
platform: platform you're building for. values is either web
or native
this option is mandatory, and the plugin will throw if you don't set it
-
example:
Using for web, which latest 2 versions of browsers :
{
presets: [
[
"@applicaster/quick-brick",
{
env: { browsers: "last 2 version" },
platform: "web"
}
]
]
}