0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
astro/.changeset/five-jars-hear.md
Bjorn Lu 93932432e7
Make directRenderScript the default (#11791)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2024-08-28 22:50:50 +08:00

852 B

astro
patch

Updates Astro's default <script> rendering strategy and removes the experimental.directRenderScript option as this is now the default behavior: scripts are always rendered directly. This new strategy prevents scripts from being executed in pages where they are not used.

Scripts will directly render as declared in Astro files (including existing features like TypeScript, importing node_modules, and deduplicating scripts). You can also now conditionally render scripts in your Astro file.

However, this means scripts are no longer hoisted to the <head>, multiple scripts on a page are no longer bundled together, and the <script> tag may interfere with the CSS styling.

As this is a potentially breaking change to your script behavior, please review your <script> tags and ensure that they behave as expected.