-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbabel.config.js
More file actions
34 lines (30 loc) · 984 Bytes
/
babel.config.js
File metadata and controls
34 lines (30 loc) · 984 Bytes
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) {
api.cache(true)
const presets = []
/*
* env-preset options
* we won't include all polyfills because of env-preset can automatically detect
* by looking our codebase and decide which polyfills should be imported based on
* the file .browserslistrc. that's what useBuiltIns and corejs options are for.
*/
const envPresetOpts = {
useBuiltIns: process.env.USE_POLYFILLS == 'on' ? 'usage' : false,
corejs: process.env.USE_POLYFILLS == 'on' ? {version: 3, proposals: true} : undefined,
debug: process.env.POLYFILL_REPORTING == 1 ? true : false
}
presets.push(['@babel/env', envPresetOpts])
/*
* notes
*
* 1. babel's minify-preset doesn't work with useBuiltIns: 'usage'
* therefore we preferred terser rollup plugin.
* 2. the other options specified below are for compatibility with rollup
*
*/
return {
babelrc: false,
exclude: ['node_modules/**'],
presets: presets,
plugins: []
}
}