@@ -74,8 +74,17 @@ yargs.usage(
74
74
`${ getVersions ( ) } \nUsage: https://webpack.js.org/configuration/dev-server/`
75
75
) ;
76
76
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
+ }
77
85
// 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 ) ;
79
88
80
89
// It is important that this is done after the webpack yargs config,
81
90
// so it overrides webpack's version info.
@@ -84,8 +93,17 @@ yargs.options(options);
84
93
85
94
const argv = yargs . argv ;
86
95
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
+ }
87
104
// 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 , {
89
107
outputFilename : '/bundle.js' ,
90
108
} ) ;
91
109
0 commit comments