Closed matsp closed 4 years ago
Hi there - I might be missing something, but since it's not possible to preload workers, your HTML can't do anything with the knowledge of the worker script.
Just a note, I did some research on this and the only working solution is to use <link rel=prefetch>
to preload the Worker script. It won't preparse and has a lower priority than preload requests, but it does preload the Worker. Also make sure to set crossorigin
to the appropriate value.
Closing since this is a platform limitation with a solution. Happy to discuss on Twitter though!
I am actually using a worker to outsource work of a component that is loaded at start time of the page. My "index" chunk is loading the worker chunk on page load - the will slow down the app.
From reading the "plugins" section of the docs I don't get how to integrate my worker chunk as asset in the HTMLPlugin.
My simple HTMLPlugin config (for the hole app):
Also using additonal plugins for the production build:
Does anyone have an idea how to get the same behavior for worker chunks generated by the worker-plugin?
Thanks in advance!