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

[Bug?] Parent compiler's plugins are not inherited into the child compiler. #13

Closed
lacolaco opened this issue Nov 22, 2018 · 3 comments
Closed

Comments

@lacolaco
Copy link
Contributor

lacolaco commented Nov 22, 2018

My story is here: https://medium.com/lacolaco-blog/an-issue-around-angular-cli-comlink-workerplugin-585be1c8d087

My friend @manfredsteyer figured out the cause of the error. WorkerPlugin creates a child webpack compiler for worker module's compilation.

https://github.com/GoogleChromeLabs/worker-plugin/blob/master/src/loader.js#L42

const workerCompiler = this._compilation.createChildCompiler(NAME, workerOptions);

createChildCompiler API takes three arguments; its name, outputOptions, and plugins. The current implementation in WorkerPlugin doesn't pass the 3rd argument, so the child compiler doesn't has plugins inherited from the parent.

Solution:

Add the 3rd argument and pass compilerOptions.plugin.

const workerCompiler = this._compilation.createChildCompiler(NAME, workerOptions, compilerOptions.plugins);

In my case, it works well as I expected.

If this is by design, I'd like to know the reason.

@lacolaco
Copy link
Contributor Author

@developit Could you let me know your view? Thanks.

@developit
Copy link
Collaborator

developit commented Dec 4, 2018

I've released this as 2.0.1 - give it a try and let me know if it works. I think we'll probably be playing whack-a-mole disabling plugins for a while though. If it causes too many issues we'll have to switch to having an option of "plugins to allow".

@lacolaco
Copy link
Contributor Author

lacolaco commented Dec 4, 2018

@developit Thank you! In my case, v2.0.1 works perfectly. I've confirmed no errors and no degradation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants