-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
37 lines (34 loc) · 1.14 KB
/
babel.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module.exports = function(api) {
// https://babeljs.io/docs/en/config-files#apicache
// We can even use `process.env.NODE_ENV` but because we are creating modern and legacy
// bundles via webpack, we need to invalidate the cache when `BROWSERSLIST_ENV` changes
// programatically from within the main `js-compiler` task.
// Another way of doing this will be not to use the babel config file and pass the config within babel-loader.
api.cache.invalidate(() => process.env.BROWSERSLIST_ENV);
const presets = [
[
'@babel/preset-env',
{
// Do not transform modules to CJS, Webpack will take care of that
modules: false,
useBuiltIns: 'entry',
// Don't log anything on the console
debug: false,
// Set the corejs version we are using to avoid warnings in console
// This will need to change once we upgrade to corejs@3
corejs: 3,
// Exclude transforms that make all code slower
exclude: ['transform-typeof-symbol']
}
]
];
const plugins = [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime'
];
return {
presets,
plugins
};
};