-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.babelrc.js
46 lines (43 loc) · 899 Bytes
/
.babelrc.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
const sharedPresets = ['@babel/preset-typescript'];
const plugins = ['@babel/plugin-proposal-optional-chaining'];
const shared = {
ignore: ['src/**/*.spec.ts'],
presets: sharedPresets,
};
module.exports = {
env: {
esmUnbundled: shared,
esmBundled: {
...shared,
plugins: [...plugins, 'babel-plugin-add-import-extension'],
presets: [
...sharedPresets,
[
'@babel/env',
{
targets: '> 1%, not dead',
},
],
],
},
cjs: {
...shared,
plugins: [
...plugins,
['babel-plugin-add-import-extension', { extension: 'cjs' }],
],
presets: [
...sharedPresets,
[
'@babel/env',
{
modules: 'commonjs',
},
],
],
},
test: {
presets: [...sharedPresets, '@babel/env'],
},
},
};