forked from jquense/react-big-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babel.config.js
51 lines (47 loc) · 1.3 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
41
42
43
44
45
46
47
48
49
50
51
module.exports = function (api) {
//api.cache(false)
const isCJSBuild = process.env.RBC_CJS_BUILD === 'true'
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',
},
}),
},
],
// FIXME: Passing `useESModules` to babel-preset-react-app is an
// undocumented feature. Should be avoided. This option is also deprecated
// according to
// https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules
[
'react-app',
{
useESModules: !isCJSBuild,
absoluteRuntime: false,
},
],
],
plugins: [
['@babel/plugin-transform-runtime'],
['transform-react-remove-prop-types', { mode: 'wrap' }],
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }],
...optionalPlugins,
],
}
return config
}