Skip to content

Fix script injection during build#12392

Merged
ematipico merged 16 commits intowithastro:mainfrom
apatel369:arpan-#12171
Nov 14, 2024
Merged

Fix script injection during build#12392
ematipico merged 16 commits intowithastro:mainfrom
apatel369:arpan-#12171

Conversation

@apatel369
Copy link
Copy Markdown
Contributor

@apatel369 apatel369 commented Nov 7, 2024

Changes

Closes #12171
This pull request addresses issue #12171 where shared entrypoints in injectRoute() remove client-side scripts in SSR builds. The changes ensure that client-side scripts are correctly included for all routes using the same entrypoint.

Testing

added tests

Docs

Internal bug fix so docs update not needed

@github-actions github-actions Bot added the pkg: astro Related to the core `astro` package (scope) label Nov 7, 2024
@ematipico
Copy link
Copy Markdown
Member

Should we add new tests?

@apatel369
Copy link
Copy Markdown
Contributor Author

apatel369 commented Nov 7, 2024 via email

@apatel369
Copy link
Copy Markdown
Contributor Author

Should we add new tests?

Added. Thanks for your patience. Let me know if any changes are needed.

Comment thread .changeset/slimy-pets-lick.md Outdated
value: id,
};
}
for (const pageData of getPageDatasByHoistedScriptId(internals, facadeId)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As you noticed from the Github bot comments, settings isn't used anymore, so we can remove it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed. Thanks.

apatel369 and others added 2 commits November 12, 2024 08:53
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
@apatel369 apatel369 changed the title Fix script handling in injectRoute shared entrypoint during SSR Fix script injection during build Nov 12, 2024
@ematipico
Copy link
Copy Markdown
Member

@apatel369 the build is failing, can you please fix it?

@apatel369
Copy link
Copy Markdown
Contributor Author

@apatel369 the build is failing, can you please fix it?

Fixed.

@ematipico ematipico merged commit 0462219 into withastro:main Nov 14, 2024
@astrobot-houston astrobot-houston mentioned this pull request Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared entrypoint in injectRoute() Removes Client-Side Scripts in SSR Build

2 participants