File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,14 @@ const { pathToFileURL } = require("url");
5757const util = require ( "util" ) ;
5858const { program, Option } = require ( "commander" ) ;
5959
60- const WEBPACK_PACKAGE = process . env . WEBPACK_PACKAGE || "webpack" ;
61- const WEBPACK_DEV_SERVER_PACKAGE = process . env . WEBPACK_DEV_SERVER_PACKAGE || "webpack-dev-server" ;
60+ const WEBPACK_PACKAGE_IS_CUSTOM = ! ! process . env . WEBPACK_PACKAGE ;
61+ const WEBPACK_PACKAGE = WEBPACK_PACKAGE_IS_CUSTOM
62+ ? ( process . env . WEBPACK_PACKAGE as string )
63+ : "webpack" ;
64+ const WEBPACK_DEV_SERVER_PACKAGE_IS_CUSTOM = ! ! process . env . WEBPACK_DEV_SERVER_PACKAGE ;
65+ const WEBPACK_DEV_SERVER_PACKAGE = WEBPACK_DEV_SERVER_PACKAGE_IS_CUSTOM
66+ ? ( process . env . WEBPACK_DEV_SERVER_PACKAGE as string )
67+ : "webpack-dev-server" ;
6268
6369interface Information {
6470 Binaries ?: string [ ] ;
@@ -566,12 +572,12 @@ class WebpackCLI implements IWebpackCLI {
566572 let skipInstallation = false ;
567573
568574 // Allow to use `./path/to/webpack.js` outside `node_modules`
569- if ( dependency === WEBPACK_PACKAGE && fs . existsSync ( WEBPACK_PACKAGE ) ) {
575+ if ( dependency === WEBPACK_PACKAGE && WEBPACK_PACKAGE_IS_CUSTOM ) {
570576 skipInstallation = true ;
571577 }
572578
573579 // Allow to use `./path/to/webpack-dev-server.js` outside `node_modules`
574- if ( dependency === WEBPACK_DEV_SERVER_PACKAGE && fs . existsSync ( WEBPACK_PACKAGE ) ) {
580+ if ( dependency === WEBPACK_DEV_SERVER_PACKAGE && WEBPACK_DEV_SERVER_PACKAGE_IS_CUSTOM ) {
575581 skipInstallation = true ;
576582 }
577583
You can’t perform that action at this time.
0 commit comments