Skip to content

docs: update example <script> loading strategy#7663

Merged
evenstensberg merged 3 commits intowebpack:mainfrom
zowiebeha:getting-started-fix
Oct 11, 2025
Merged

docs: update example <script> loading strategy#7663
evenstensberg merged 3 commits intowebpack:mainfrom
zowiebeha:getting-started-fix

Conversation

@zowiebeha
Copy link
Copy Markdown
Contributor

@zowiebeha zowiebeha commented Oct 5, 2025

In the code examples, a <script> tag is
placed just before the ending </body> tag.
This causes the script's external resource to
download and execute only after the HTML has been
parsed up to that point.

For organization and faster script evaluation,
we can consolidate scripts in the <head>
and enable their defer attribute, which will
download the external resource in parallel with
HTML parsing. Once the HTML is parsed, the
deferred script will execute.

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 5, 2025

@zowiebeha is attempting to deploy a commit to the OpenJS Foundation Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defer is alternative loading, so let's add another one alternative example with defer, don't change currents

In the code examples, a <script> tag is
placed just before the ending </body> tag.
This causes the script's external resource to
download and execute only after the HTML has been
parsed up to that point.

For organization and faster script evaluation,
we can consolidate scripts in the <head>
and enable their defer attribute, which will
download the external resource in parallel with
HTML parsing. Once the HTML is parsed, the
deferred script will execute.
@zowiebeha zowiebeha force-pushed the getting-started-fix branch from 6b6fd05 to f14be15 Compare October 11, 2025 14:20
Comment thread src/content/guides/getting-started.mdx Outdated
@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
webpack-js-org Ready Ready Preview Comment Oct 11, 2025 10:45pm

@evenstensberg
Copy link
Copy Markdown
Member

Thank you for the contribution! 💙

@evenstensberg evenstensberg merged commit d803b54 into webpack:main Oct 11, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants