File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 35
35
"dependencies" : {
36
36
"@babel/core" : " ^7.2.2" ,
37
37
"@babel/plugin-proposal-class-properties" : " ^7.2.3" ,
38
+ "@babel/plugin-transform-runtime" : " ^7.2.0" ,
38
39
"@babel/polyfill" : " ^7.2.5" ,
39
40
"@babel/preset-env" : " ^7.2.3" ,
40
41
"@babel/preset-react" : " ^7.0.0" ,
41
42
"@babel/register" : " ^7.0.0" ,
43
+ "@babel/runtime" : " ^7.3.1" ,
42
44
"@emotion/core" : " ^10.0.6" ,
43
45
"@loadable/babel-plugin" : " ^5.2.2" ,
44
46
"@loadable/component" : " ^5.2.2" ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const common = {
6
6
] ,
7
7
}
8
8
9
- const nodeConfig = {
9
+ const nodeConfig = opts => ( {
10
10
...common ,
11
11
presets : [
12
12
...common . presets ,
@@ -18,12 +18,13 @@ const nodeConfig = {
18
18
targets : {
19
19
node : 'current' ,
20
20
} ,
21
+ ...opts [ 'preset-env' ] ,
21
22
} ,
22
23
] ,
23
24
] ,
24
- }
25
+ } )
25
26
26
- const webConfig = {
27
+ const webConfig = opts => ( {
27
28
...common ,
28
29
presets : [
29
30
...common . presets ,
@@ -33,18 +34,23 @@ const webConfig = {
33
34
modules : false ,
34
35
loose : true ,
35
36
useBuiltIns : 'entry' ,
37
+ ...opts [ 'preset-env' ] ,
36
38
} ,
37
39
] ,
38
40
] ,
39
- }
41
+ plugins : [
42
+ ...common . plugins ,
43
+ [ '@babel/plugin-transform-runtime' , opts [ 'transform-runtime' ] ] ,
44
+ ] ,
45
+ } )
40
46
41
47
function isWebTarget ( caller ) {
42
48
return Boolean ( caller && caller . name === 'babel-loader' )
43
49
}
44
50
45
- module . exports = api => {
51
+ module . exports = ( api , opts = { } ) => {
46
52
if ( api . caller ( isWebTarget ) ) {
47
- return webConfig
53
+ return webConfig ( opts )
48
54
}
49
- return nodeConfig
55
+ return nodeConfig ( opts )
50
56
}
You can’t perform that action at this time.
0 commit comments