-
Notifications
You must be signed in to change notification settings - Fork 58
/
babel.config.js
50 lines (48 loc) · 1.38 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
46
47
48
49
50
/* eslint-env node */
const plugins = [
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
];
module.exports = {
env: {
es5: {
// ES5 browsers for CJS and UMD builds
presets: [
[
// NOTE: With no targets specified, @babel/preset-env will transform all
// ECMAScript 2015+ code by default, which is the original preset prior
// to upgrading to Babel 7
// @see https://babeljs.io/docs/en/babel-preset-env#targets
'@babel/preset-env',
{
loose: true,
},
],
],
plugins,
},
esm: {
// ESM browsers for ESM builds
presets: [
[
// NOTE: With no targets specified, @babel/preset-env will transform all
// ECMAScript 2015+ code by default, which is the original preset prior
// to upgrading to Babel 7
// @see https://babeljs.io/docs/en/babel-preset-env#targets
'@babel/preset-env',
{
modules: false, // preserve ES modules
loose: true,
},
],
],
plugins,
},
test: {
// Jest/Cypress
// @see https://github.com/istanbuljs/babel-plugin-istanbul
plugins: [...plugins, 'istanbul'],
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
},
},
};