AutoGuru's org-wide Babel preset
@autoguru/babel-presetAutoGuru's org-wide Babel set of presets and
plugins.
``sh`
yarn add --dev @autoguru/babel-preset \
@babel/core
Then, in your babel.config.js, or .babelrc file:
`js`
module.exports = {
presets: [
'@autoguru/babel-preset/web', // for browser based targets
'@autoguru/babel-preset/react', // additional presets for web based react projects
],
};
- @autoguru/babel-preset is merely an alias of @autoguru/babel-preset/web.@autoguru/babel-preset/node
- is for node based targets.
- version (default: current) - the version of node you're targetingmodules
- (default: commonjs) - what module transformations to apply.debug
- (default: isProduction) - a boolean indicating if you want debugcorejs
information from
@babel/preset-env.
- (default: 3) - The version of core-js to use.
- @autoguru/babel-preset/web is used for browser based targets, which adds
typical transformations needed to support esnext features on older browsers.
This will look for a
browserslist config file up
the tree.
- modules (default: false) - if you require module transformations. Falsedebug
is default as we use webpack's bundling system and want naked esmodules.
- (default: isProduction) - a boolean indicating if you want debugcorejs
information from
@babel/preset-env.
- (default: 3) - The version of core-js to use.
- @autoguru/babel-preset/react is for React based projects, includingFunctionComponents
transformations for JSX. Also hoists to the root, where@autoguru/babel-preset/web`.
it can. See
@babel/plugin-transform-react-constant-elements
. You can use this alongside