-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbabel.config.cjs
38 lines (33 loc) · 1.26 KB
/
babel.config.cjs
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
const env = process.env.BABEL_ENV || 'esm';
module.exports = {
targets: {
node: '12.13', // Support Node v12.13 LTS (Erbium) or higher
browsers: [
'defaults',
'not IE >= 0',
],
},
presets: [
['@babel/env', {
// Whether to transpile modules
modules: env === 'cjs' ? 'commonjs' : false,
// Do not include polyfills automatically. Leave it up to the consumer to include the right polyfills
// for their required environment.
useBuiltIns: false,
exclude: [
// Do not transpile generators (saves us from needing a polyfill)
'transform-regenerator',
],
}],
'@babel/typescript',
],
plugins: [
// Note: this may cause issues with `export * from` syntax:
// https://github.com/babel/babel-loader/issues/195 (should be fixed in the latest version)
// 'transform-runtime', // Needed to support generators
['transform-builtin-extend', {
// See: http://stackoverflow.com/questions/33870684/why-doesnt-instanceof-work
globals: ['Error', 'String', 'Number', 'Array', 'Promise'],
}],
],
};