feat: support webpackPrefetch and webpackPreload for Worker chunks (#19373)#20299
Open
samarthsinh2660 wants to merge 1 commit intowebpack:mainfrom
Open
feat: support webpackPrefetch and webpackPreload for Worker chunks (#19373)#20299samarthsinh2660 wants to merge 1 commit intowebpack:mainfrom
samarthsinh2660 wants to merge 1 commit intowebpack:mainfrom
Conversation
|
61478c7 to
96e722e
Compare
96e722e to
c781429
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds support for
webpackPrefetchandwebpackPreloadmagic comments fornew Worker()chunks, addressing issue #19373.Currently, dynamic imports support
webpackPrefetchandwebpackPreloadmagic comments to hint the browser to prefetch/preload chunks for better performance. This PR extends the same functionality to Worker chunks.Example usage:
Closes #19373
What kind of change does this PR introduce?
feat - New feature extending prefetch/preload support to Worker chunks
Did you add tests for your changes?
Yes, added test case in
test/configCases/worker/worker-prefetch-preload/:should support webpackPrefetch for Workershould support webpackPreload for Workershould support webpackPrefetch with numeric order for Workershould support webpackPreload with numeric order for WorkerDoes this PR introduce a breaking change?
No. This is an additive feature using existing magic comment syntax.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Documentation should be updated to mention that
webpackPrefetchandwebpackPreloadmagic comments now work withnew Worker()syntax, similar to dynamicimport().