You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/WebpackConfig.js
+18-6Lines changed: 18 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -329,15 +329,22 @@ class WebpackConfig {
329
329
}
330
330
331
331
configureBabel(callback,options={}){
332
-
if(typeofcallback!=='function'){
333
-
thrownewError('Argument 1 to configureBabel() must be a callback function.');
334
-
}
332
+
if(callback){
333
+
if(typeofcallback!=='function'){
334
+
thrownewError('Argument 1 to configureBabel() must be a callback function or null.');
335
+
}
335
336
336
-
if(this.doesBabelRcFileExist()){
337
-
thrownewError('configureBabel() cannot be called because your app already has Babel configuration (a `.babelrc` file, `.babelrc.js` file or `babel` key in `package.json`). Either put all of your Babel configuration in that file, or delete it and use this function.');
337
+
if(this.doesBabelRcFileExist()){
338
+
logger.warning('The "callback" argument of configureBabel() will not be used because your app already provides an external Babel configuration (a ".babelrc" file, ".babelrc.js" file or "babel" key in "package.json"). Use null as a first argument to remove that warning.');
logger.warning(`The "${normalizedOptionKey}" option of configureBabel() will not be used because your app already provides an external Babel configuration (a ".babelrc" file, ".babelrc.js" file or "babel" key in "package.json").`);
358
+
continue;
359
+
}
360
+
349
361
if(normalizedOptionKey==='includeNodeModules'){
350
362
if(Object.keys(options).includes('exclude')){
351
363
thrownewError('"includeNodeModules" and "exclude" options can\'t be used together when calling configureBabel().');
0 commit comments