Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: pass a callback to webpack from webpack-cli #1977

Merged
merged 12 commits into from
Oct 26, 2020
2 changes: 1 addition & 1 deletion packages/webpack-cli/lib/plugins/WebpackCLIPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class WebpackCLIPlugin {

for (const compiler of compilers) {
if (this.options.progress) {
const { ProgressPlugin } = webpack;
const { ProgressPlugin } = compiler.webpack || webpack;

let progressPluginExists;

Expand Down
16 changes: 8 additions & 8 deletions packages/webpack-cli/lib/webpack-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ class WebpackCLI extends GroupHelper {
let options = this.compilerConfiguration;
let outputOptions = this.outputConfiguration;

let isWatchMode;

if (Array.isArray(options)) {
isWatchMode = options.some((options) => options.watch);
} else {
isWatchMode = options.watch;
}
piecyk marked this conversation as resolved.
Show resolved Hide resolved

const isRawOutput = typeof outputOptions.json === 'undefined';

if (isRawOutput) {
Expand Down Expand Up @@ -320,14 +328,6 @@ class WebpackCLI extends GroupHelper {
logger.raw(`${stats.toString(foundStats)}`);
}

let isWatchMode = false;

if (Array.isArray(options)) {
isWatchMode = options.some((options) => options.watch);
} else {
isWatchMode = options.watch;
}

if (isWatchMode) {
logger.success('watching files for updates...');
}
Expand Down