-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
feat: add webpackPrefetch/webpackPreload/webpackFetchPriority support for URL-based assets
#19695
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
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #19695 will improve performances by 20.58%Comparing Summary
Benchmarks breakdown
|
329587d to
13027da
Compare
f0ffcb7 to
2bb3de1
Compare
webpackPrefetch / webpackPreload / webpackFetchPriority support for Worker syntaxwebpackPrefetch/webpackPreload/webpackFetchPriority support for URL-based assets
2bb3de1 to
3cc5c91
Compare
Standards and constraints
Why numeric order is only for Worker (not URL)
|
test/configCases/asset-modules/url-prefetch-preload-fetchpriority/index.js
Outdated
Show resolved
Hide resolved
e059f1b to
9ff7ec7
Compare
76d6374 to
270fdeb
Compare
|
rebased |
270fdeb to
a84e769
Compare
a84e769 to
f7283bc
Compare
|
How about the |
|
@PupilTong We don't have |
|
Let's try to get this reviewd, patched and merged soon. |
… for Worker syntax
…upport for new URL() syntax
- Consolidate multiple runtime modules into unified AssetResourcePrefetchPlugin - Remove complex startup prefetch mechanism in favor of simpler inline approach
…PrefetchRuntimeModule`
- Introduced `preloadAs`, `preloadType`, and `preloadMedia` properties to `URLDependency` for better control over asset preloading.
…Type`, and `webpackPreloadMedia` values.
a8d39c0 to
aaae36e
Compare
|
Rebased this on the latest. |
|
@3ru Thanks, a lot of tasks, still in my TODO 😞 |
PR Description
This PR refreshes prefetch/preload support across Worker chunks and
new URL()assets, aligns the behavior with dynamicimport(), and introduces new runtime helpers.fixes
webpackPrefetch/webpackPreload/webpackFetchPriorityfornew Workersyntax #19377webpackPrefetchandwebpackPreloadfornew Worker()chunk #19373webpackPrefetchfornew URL(...)#18524What kind of change does this PR introduce?
Adds magic comment support to configure resource hints:
new URL()assets (boolean flags + fetch priority + explicit preload attribute overrides)<link>elements at runtime:prefetchAssetandpreloadAssetSupported magic comments
/* webpackPrefetch: true | number *//* webpackPreload: true | number *//* webpackFetchPriority: "high" | "low" | "auto" */new URL()assets:/* webpackPrefetch: true *//* webpackPreload: true *//* webpackFetchPriority: "high" | "low" | "auto" *//* webpackPreloadAs: "<request-destination>" *//* webpackPreloadType: "<mime/type>" *//* webpackPreloadMedia: "<media-query>" */Notes:
import()), URL assets do not.webpackPreloadAs/webpackPreloadType/webpackPreloadMediaoverride the auto-detected defaults for URL assets.asattribute accepts Fetch Standard request destinations. Allowed values include:audio,audioworklet,document,embed,fetch,font,image,manifest,object,paintworklet,report,script,sharedworker,serviceworker,style,track,video,worker,xslt.Example Usage
Did you add tests for your changes?
Yes
Does this PR introduce a breaking change?
No
What needs to be documented once your changes are merged?
webpackPrefetch: true/webpackPreload: truewebpackFetchPriority: "high" | "low" | "auto"as(based on file type), with explicit overrides:webpackPreloadAs: "<request-destination>"(Fetch Request Destinations; includesaudio,audioworklet,document,embed,fetch,font,image,manifest,object,paintworklet,report,script,sharedworker,serviceworker,style,track,video,worker,xslt)webpackPreloadType: "<mime/type>"webpackPreloadMedia: "<media-query>"rel