@@ -132,7 +132,15 @@ exports.handler = (argv) => {
132
132
}
133
133
134
134
// we use defaults presets and plugins for react if nothing is found
135
- babelConfig . presets = babelConfig . presets || [ '@babel/preset-react' ] ;
135
+ babelConfig . presets = babelConfig . presets || [
136
+ [
137
+ '@babel/preset-env' ,
138
+ {
139
+ modules : false ,
140
+ } ,
141
+ ] ,
142
+ '@babel/preset-react' ,
143
+ ] ;
136
144
babelConfig . plugins = babelConfig . plugins || [
137
145
'@babel/plugin-transform-runtime' ,
138
146
'@babel/plugin-transform-async-to-generator' ,
@@ -146,16 +154,21 @@ exports.handler = (argv) => {
146
154
} ,
147
155
] ,
148
156
] ;
157
+
149
158
// do not use presets that are not installed
150
159
babelConfig . presets = babelConfig . presets . filter ( ( preset ) => {
151
160
const name = typeof preset === 'string' ? preset : preset [ 0 ] ;
152
- return ! ! fs . existsSync ( path . join ( argv . path , 'node_modules' , name ) ) ;
161
+ const absPath = fs . existsSync ( name ) ;
162
+ const relPath = fs . existsSync ( path . join ( argv . path , 'node_modules' , name ) ) ;
163
+ return absPath || relPath ;
153
164
} ) ;
154
165
155
166
// do not use plugins that are not installed
156
167
babelConfig . plugins = babelConfig . plugins . filter ( ( plugin ) => {
157
168
const name = typeof plugin === 'string' ? plugin : plugin [ 0 ] ;
158
- return ! ! fs . existsSync ( path . join ( argv . path , 'node_modules' , name ) ) ;
169
+ const absPath = fs . existsSync ( name ) ;
170
+ const relPath = fs . existsSync ( path . join ( argv . path , 'node_modules' , name ) ) ;
171
+ return absPath || relPath ;
159
172
} ) ;
160
173
161
174
// we add react-intl plugins to the list
0 commit comments