Allowing scriptLoading type async in addition to defer
See original GitHub issueIs your feature request related to a problem? Please describe.
Loading a script with defer is executing the script as soon as it is loaded and therefore might interrupt other parsing. Adding the async attribute instead is allowing the browser to decide when to execute the script and therefore allows a better control over the importance of the script execution by the developer.
Describe the solution you’d like
Add a scriptLoading option for async to control the described behaviour better.
Describe alternatives you’ve considered Currently i am using a deprecated Webpack plugin just to achieve this (script-ext-html-webpack-plugin).
Additional context
There is currently a PR #1672 open for adding module as an option, adding async should be an easy addition to that PR.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (3 by maintainers)

Top Related StackOverflow Question
Hi @jantimon,
that makes sense, i actually mixed up the behaviour of
asyncanddefer. After checking again the pros and cons i think it is a good decision to go with defer, as the use cases forasyncare rather slim.@guanzo I guess that’s really the case for async but unfortunately a real edge case for regular webpack users…
What you can do is to change the script loading with a hook to async or turn auto injection off