Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have the same issue with #3615 , so I tried to solve it.
The current logic:
Uses the loaderUtils.interpolateName method to generate the filename, and then passed it to AddWorkerEntryPointPlugin and its internal SingleEntryPlugin.
The problem:
The generated filename only depends on the content of the worker's entry file, but does not consider changes in the content of the referenced dependency files
My changes:
passes the filename template directly to SingleEntryPlugin, allowing webpack to handle the hash logic.
since the contenthash can only be determined after the webpack assets optimization phase, some logic needs to be changed to be asynchronous:
2.1. The loader has been changed to be asynchronous.
2.2. A task is created for each childCompiler. The final filename for each worker is collected in the afterOptimizeAssets phase of the childCompilation, and then invoke task's resolve method.
2.3. When all tasks are resolved, the loader calls the callback and writes the collected filenames to editor.main.js.