Skip to content

Commit

Permalink
fix: compatibility with [email protected] (#1754)
Browse files Browse the repository at this point in the history
  • Loading branch information
EslamHiko authored and evilebottnawi committed Apr 3, 2019
1 parent 732e6c5 commit fd7cb0d
Show file tree
Hide file tree
Showing 3 changed files with 2,506 additions and 2,536 deletions.
22 changes: 20 additions & 2 deletions bin/webpack-dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,17 @@ yargs.usage(
`${getVersions()}\nUsage: https://webpack.js.org/configuration/dev-server/`
);

// [email protected] path : 'webpack-cli/bin/config/config-yargs'
let configYargsPath;
try {
require.resolve('webpack-cli/bin/config/config-yargs');
configYargsPath = 'webpack-cli/bin/config/config-yargs';
} catch (e) {
configYargsPath = 'webpack-cli/bin/config-yargs';
}
// eslint-disable-next-line import/no-extraneous-dependencies
require('webpack-cli/bin/config-yargs')(yargs);
// eslint-disable-next-line import/no-dynamic-require
require(configYargsPath)(yargs);

// It is important that this is done after the webpack yargs config,
// so it overrides webpack's version info.
Expand All @@ -84,8 +93,17 @@ yargs.options(options);

const argv = yargs.argv;

// [email protected] path : 'webpack-cli/bin/utils/convert-argv'
let convertArgvPath;
try {
require.resolve('webpack-cli/bin/utils/convert-argv');
convertArgvPath = 'webpack-cli/bin/utils/convert-argv';
} catch (e) {
convertArgvPath = 'webpack-cli/bin/convert-argv';
}
// eslint-disable-next-line import/no-extraneous-dependencies
const config = require('webpack-cli/bin/convert-argv')(yargs, argv, {
// eslint-disable-next-line import/no-dynamic-require
const config = require(convertArgvPath)(yargs, argv, {
outputFilename: '/bundle.js',
});

Expand Down
Loading

0 comments on commit fd7cb0d

Please sign in to comment.