@@ -6,6 +6,7 @@ const importCwd = require('import-cwd');
66const fs = require ( 'fs-extra' ) ;
77const path = require ( 'path' ) ;
88const ora = require ( 'ora' ) ;
9+ const assert = require ( 'assert' ) ;
910
1011const {
1112 flags : { buildPath, publicPath, reactScriptsVersion, verbose, disableChunks } ,
@@ -23,8 +24,8 @@ const config =
2324 ? importCwd ( './config/webpack.config' )
2425 : importCwd ( 'react-scripts/config/webpack.config' ) ) ( 'development' )
2526 : isEjected
26- ? importCwd ( './config/webpack.config.dev' )
27- : importCwd ( 'react-scripts/config/webpack.config.dev' ) ;
27+ ? importCwd ( './config/webpack.config.dev' )
28+ : importCwd ( 'react-scripts/config/webpack.config.dev' ) ;
2829
2930const HtmlWebpackPlugin = importCwd ( 'html-webpack-plugin' ) ;
3031const InterpolateHtmlPlugin = importCwd ( 'react-dev-utils/InterpolateHtmlPlugin' ) ;
@@ -60,6 +61,7 @@ config.output.filename = `js/bundle.js`;
6061config . output . chunkFilename = `js/[name].chunk.js` ;
6162
6263if ( disableChunks ) {
64+ assert ( major >= 2 , 'Split chunks optimization is only available in react-scripts >= 2.0.0' ) ;
6365 // disable code-splitting/chunks
6466 config . optimization . runtimeChunk = false ;
6567
@@ -106,8 +108,7 @@ spinner.start('Clear destination folder');
106108
107109let inProgress = false ;
108110
109- fs
110- . emptyDir ( paths . appBuild )
111+ fs . emptyDir ( paths . appBuild )
111112 . then ( ( ) => {
112113 spinner . succeed ( ) ;
113114
0 commit comments