4

I know how to add entry dynamically in webpack plugin, like below:

class AddEntryPlugin {
    apply(compiler) {
        compiler.plugin('entry-option', () => {
            compiler.apply(new SingleEntryPlugin(context, request, name))
        })
        compiler.plugin('watch-run', ({ compiler }, done) =>
            compiler.apply(new SingleEntryPlugin(context, request, name))
            done()
        )
    }
}

However I need to remove added entries when invoking watch-run hook, so how to remove the entries?

Run
  • 876
  • 6
  • 21

0 Answers0