@@ -74,8 +74,17 @@ yargs.usage(
7474 `${ getVersions ( ) } \nUsage: https://webpack.js.org/configuration/dev-server/`
7575) ;
7676
77+ // [email protected] path : 'webpack-cli/bin/config/config-yargs' 78+ let configYargsPath ;
79+ try {
80+ require . resolve ( 'webpack-cli/bin/config/config-yargs' ) ;
81+ configYargsPath = 'webpack-cli/bin/config/config-yargs' ;
82+ } catch ( e ) {
83+ configYargsPath = 'webpack-cli/bin/config-yargs' ;
84+ }
7785// eslint-disable-next-line import/no-extraneous-dependencies
78- require ( 'webpack-cli/bin/config-yargs' ) ( yargs ) ;
86+ // eslint-disable-next-line import/no-dynamic-require
87+ require ( configYargsPath ) ( yargs ) ;
7988
8089// It is important that this is done after the webpack yargs config,
8190// so it overrides webpack's version info.
@@ -84,8 +93,17 @@ yargs.options(options);
8493
8594const argv = yargs . argv ;
8695
96+ // [email protected] path : 'webpack-cli/bin/utils/convert-argv' 97+ let convertArgvPath ;
98+ try {
99+ require . resolve ( 'webpack-cli/bin/utils/convert-argv' ) ;
100+ convertArgvPath = 'webpack-cli/bin/utils/convert-argv' ;
101+ } catch ( e ) {
102+ convertArgvPath = 'webpack-cli/bin/convert-argv' ;
103+ }
87104// eslint-disable-next-line import/no-extraneous-dependencies
88- const config = require ( 'webpack-cli/bin/convert-argv' ) ( yargs , argv , {
105+ // eslint-disable-next-line import/no-dynamic-require
106+ const config = require ( convertArgvPath ) ( yargs , argv , {
89107 outputFilename : '/bundle.js' ,
90108} ) ;
91109
0 commit comments