-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.babelrc.js
More file actions
29 lines (28 loc) · 748 Bytes
/
.babelrc.js
File metadata and controls
29 lines (28 loc) · 748 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
'use strict';
const output = process.env.BABEL_OUTPUT;
const requirePolyfills = process.env.INCLUDE_POLYFILLS;
const modules = output == null ? false : output;
const options = {
presets: [
['@babel/env', {loose: true, modules}],
'@babel/react',
[
'@babel/preset-typescript',
{
isTSX: true,
allExtensions: true,
},
],
],
plugins: ['@babel/plugin-transform-react-jsx'],
env: {
test: {
// extra configuration for process.env.NODE_ENV === 'test'
presets: ['@babel/env'], // overwrite env-config from above with transpiled module syntax
},
},
};
if (requirePolyfills) {
options.plugins.push(['@babel/plugin-transform-runtime', {corejs: 3}]);
}
module.exports = options;