Webpack-cli: [BUG]: Multiple config throws error calling tap on undefined in webpack-cli

Created on 22 May 2019  路  8Comments  路  Source: webpack/webpack-cli


Bug report




What is the current behavior?
When running webpack with --info-verbosity verbose and multiple configs the following error is thrown. The MultiCompiler does not define a beforeRun hook.

```node_modules/webpack-cli/bin/cli.js:281
compiler.hooks.beforeRun.tap("WebpackInfo", compilation => {
^

TypeError: Cannot read property 'tap' of undefined
at processOptions (node_modules/webpack-cli/bin/cli.js:281:31)
at yargs.parse (node_modules/webpack-cli/bin/cli.js:373:3)
at Object.parse (node_modules/webpack-cli/node_modules/yargs/yargs.js:567:18)
at node_modules/webpack-cli/bin/cli.js:49:8
at Object. (node_modules/webpack-cli/bin/cli.js:375:3)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object. (node_modules/webpack/bin/webpack.js:156:2)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
```

If the current behavior is a bug, please provide the steps to reproduce.
Create a multiple config webpack and run webpack with --info-verbosity verbose.






What is the expected behavior?
MultiCompiler should define a beforeRun hook.


Other relevant information:
webpack version: 4.32.1
Node.js version: v10.15.3
Operating System: MacOS 10.14.4
Additional tools:

Bug Good First Contribution needs investigation

Most helpful comment

Hi, yes. For example, if I run webpack --info-verbosity verbose in https://github.com/webpack/webpack/tree/master/examples/multi-compiler it reproduces the issue.

All 8 comments

Is this still happening to you?

Hi, yes. For example, if I run webpack --info-verbosity verbose in https://github.com/webpack/webpack/tree/master/examples/multi-compiler it reproduces the issue.

Okay thanks for reporting, will have a look when there's time. If anyone else wants to fix, this is at master branch.

is this issue still open? can i take this issue?

So, when webpack gets multiple config input. It gives back in Instance of multiCompiler. So, for each compiler in multiCompiler.compilers, we need to hook our plugins. I tried fixing that and It worked.

Any suggestions ?

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

Bump, I think fixed, need tests

We have stats tests, so we can close it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sumukhah picture sumukhah  路  3Comments

luillyfe picture luillyfe  路  4Comments

heyalbert picture heyalbert  路  3Comments

jbottigliero picture jbottigliero  路  5Comments

snitin315 picture snitin315  路  5Comments