How can i update plugin instance on runtime?
NiceOkay opened this issue · 4 comments
NiceOkay commented
Prerequisites
Description
I run webpack on watch mode and my templates will can dynamic removed or added:
- how can i create new instance for added templates without restart process and hooks.initialize (because hooks.iitialize emitted before hooks.watchRun)
- how can i disabled existing instance for removed template (entrypoint), so that are no errors in compilation (Error: Child compilation failed: Module not found:)
jantimon commented
Unfortunately this is not possible right now.
The easiest approach would probably be to us a client side router..
NiceOkay commented
thanks for the answer, I don't even know what i can think of :)
NiceOkay commented
Point 1:
when added new template i create new instance and call hooks.initialize
const plugin = new HtmlWebpackPlugin(...options);
plugin.apply(compiler);
compiler.options.plugins.push(plugin);
compiler.hooks.initialize.call();
its work
stale commented
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.