Skip to content

Commit

Permalink
Don't rely on webpack's webpack-cli installed check
Browse files Browse the repository at this point in the history
This doesn't work because it requires webpack-cli if it is installed, thus webpack-cli will startup which we do not want.
  • Loading branch information
SpaceK33z committed Feb 14, 2018
1 parent 087bf04 commit 8bc0e45
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bin/webpack-dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ if (importLocal(__filename)) {
const Server = require('../lib/Server');
const webpack = require('webpack'); // eslint-disable-line

// webpack has a nice message when webpack-cli is not installed, by requiring it we can also show that
require('webpack/bin/webpack');
try {
require.resolve('webpack-cli');
} catch (e) {
console.error('The CLI moved into a separate package: webpack-cli.');
console.error("Please install 'webpack-cli' in addition to webpack itself to use the CLI.");
console.error('-> When using npm: npm install webpack-cli -D');
console.error('-> When using yarn: yarn add webpack-cli -D');
process.exitCode = 1;
}

function versionInfo() {
return `webpack-dev-server ${require('../package.json').version}\n` +
Expand Down

0 comments on commit 8bc0e45

Please sign in to comment.