-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
34 lines (34 loc) · 1.33 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
module.exports = function (api) {
const modulesEnabled = api.env('test');
api.cache.using(function () {
return process.env.NODE_ENV;
});
return {
presets: [
// We don't need to convert import/export statements unless in test/Jest environment (as Webpack will handle later; not converting here preserves code-splitting).
// @see https://stackoverflow.com/questions/63563485/how-can-i-preserve-dynamic-import-statements-with-babel-preset-env
['@babel/preset-env', { modules: modulesEnabled ? 'auto' : false }],
'@babel/preset-react',
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-class-properties',
'babel-plugin-minify-dead-code-elimination',
['@babel/plugin-proposal-decorators', { legacy: true }],
[
'@babel/transform-async-to-generator',
{
module: 'bluebird',
method: 'coroutine',
},
],
[
'@babel/plugin-proposal-pipeline-operator',
{ proposal: 'minimal' },
],
['@babel/plugin-transform-runtime'],
],
comments: true,
};
};