-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathbabel.config.js
More file actions
45 lines (42 loc) · 1.08 KB
/
Copy pathbabel.config.js
File metadata and controls
45 lines (42 loc) · 1.08 KB
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
module.exports = function (api) {
const isESMBuild = process.env.RBC_ESM_BUILD === 'true'
const optionalPlugins = []
if (isESMBuild) {
optionalPlugins.push([
'babel-plugin-transform-rename-import',
{
replacements: [{ original: 'lodash', replacement: 'lodash-es' }],
},
])
}
const config = {
presets: [
[
'@babel/preset-env',
{
...(api.env('test') && {
targets: {
node: 'current',
},
}),
},
],
[
'@babel/preset-react',
{
development: api.env('development') || api.env('test'),
runtime: 'classic',
},
],
],
plugins: [
['@babel/plugin-transform-runtime'],
['@babel/plugin-transform-class-properties', { loose: true }],
['@babel/plugin-transform-private-methods', { loose: true }],
['@babel/plugin-transform-private-property-in-object', { loose: true }],
['transform-react-remove-prop-types', { mode: 'wrap' }],
...optionalPlugins,
],
}
return config
}