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
"fetchPriority" for script tags #16989
Comments
@aboktor (also cc @alexander-akait @snitin315): If we create an Similar to how we provide the import(
/* webpackInclude: /\.json$/ */
/* webpackExclude: /\.noimport\.json$/ */
/* webpackChunkName: "my-chunk-name" */
/* webpackMode: "lazy" */
/* webpackPrefetch: true */
/* webpackPreload: true */
`./locale/${language}`
); Would it be a better design to have customizable fetch priority per each lazy-loaded bundle? import(
/* webpackFetchPriority: "high" */
`./locale/${language}`
); Alternatively we could have both options. If we go that route I would want to limit the users barrier to complexity with managing both of the options and how they override eachother. That would need to be fleshed out if so. A suggestion for this "dual design" would be:
Thoughts? |
My usecase requires applying it globally to every lazy loaded bundle. |
If you are onboard with this work as suggested, I think we are happy to take a PR for this. Can iterate on regular or draft PR. Either works! |
@aboktor Let's use |
@aboktor i.e. I think we don't need |
@alexander-akait So basically use |
@aboktor Yeah, so you can apply it in different places, also |
I'm on board with this. It still applies the "global nature" for dev experience but is customizable at the module rule level and can apply to many module types. |
Feature Request
Ability to set fetchPriority attribute on script tags.
Webpack doesn't offer any way to set fetchPriority attribute on script tags that are managed/added by webpack.
I propose adding
output.scriptFetchPriorty
option with valuesboolean = false, string: 'high' | 'low' | 'auto'
When !== false, it is used in LoadScriptRuntimeModule to add the attribute to the script tag.
Relevant links
https://html.spec.whatwg.org/multipage/scripting.html#the-script-element
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#browser_compatibility
The text was updated successfully, but these errors were encountered: