shama / webpack-stream

:tropical_drink: Run webpack through a stream interface
MIT License
1.4k stars 123 forks source link

Fix webpack watch mode #200

Closed the-ress closed 6 years ago

the-ress commented 6 years ago

Webpack watch mode is broken for me. When using single configuration, it compiles only once. With multiple configurations, it complains that compiler.watchings doesn't exist.

It seems this was introduced with 95ab0896973fc14f21307ff6f94655c0c0327bbf. This commit changed the way the compilation is started from running webpack with a callback to calling the run method separately.

Calling webpack with a callback called run or watch automatically and returned Compiler, MultiCompiler, Watching or MultiWatching.

Now, when calling webpack without the callback, it always returns Compiler or MultiCompiler, but webpack-stream still expects to get MultiWatching when runing in the watch mode with multiple configurations.

This PR removes special cases for [Multi]Watching and calls watch instead of run method when appropriate.

shama commented 6 years ago

Nice fix! Thanks a bunch!