-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbabel.config.js
40 lines (39 loc) · 1.42 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
const BABELRC_ROOTS = ['src/*'];
module.exports = {
// Note: Preset ordering is reversed (last to first)
presets: [
'@babel/react',
[
'@babel/env',
{
/**
* Note: With useBuiltIns 'usage' option Babel goes through targets (specified in package.json "browserslist") and
* uses 'core-js' package to add specific polyfills in bundle when they are needed based on that targets.
* Alternatively, 'entry' option could be used but it will require add core-js polyfills directly in entry file.
* As all of them will be included in that case bundle size increases.
*/
useBuiltIns: 'usage',
corejs: 3,
},
],
/**
* Note: By transpiling TypeScript code with Babel, you gain on speed but you completely lose compile time type safety.
* Therefore, additional test script were added to package.json ("test:tsc") which is used as pre-commit(push) hook and in CI/CD scope.
*/
'@babel/typescript',
],
plugins: ['@babel/plugin-transform-runtime'],
env: {
production: {
plugins: [],
babelrcRoots: BABELRC_ROOTS,
},
development: {
plugins: [],
babelrcRoots: BABELRC_ROOTS,
},
test: {
plugins: [],
},
},
};