-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
babel.config.js
45 lines (40 loc) · 1.16 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
38
39
40
41
42
43
44
45
// for ESM don't transpile modules
const envConfig = {
modules: 'commonjs',
};
if (process.env.ESM) {
envConfig.modules = false;
envConfig.targets = { node: 'current' };
envConfig.bugfixes = true;
}
if (process.env.CDN) {
envConfig.modules = 'umd';
envConfig.targets = null;
}
module.exports = {
presets: [
[require.resolve('@babel/preset-env'), envConfig],
require.resolve('@babel/preset-react'),
require.resolve('@babel/preset-typescript'),
],
env: {
test: {
presets: [
[require.resolve('@babel/preset-env'), envConfig],
[require.resolve('@babel/preset-react'), { runtime: 'automatic' }],
require.resolve('@babel/preset-typescript'),
],
plugins: [require.resolve('babel-plugin-macros')],
},
development: {
compact: false,
},
},
plugins: [
require.resolve('@babel/plugin-proposal-class-properties'),
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
require.resolve('@babel/plugin-proposal-optional-chaining'),
require.resolve('@babel/plugin-transform-private-methods'),
['babel-plugin-transform-import-meta', { module: 'ES6' }],
],
};