Skip to content

Commit

Permalink
reorder for structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah11918 authored Jan 10, 2025
1 parent 181b74f commit 1c24751
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/content/docs/en/guides/upgrade-to/v5.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,14 @@ In the event of route collisions, where two routes of equal route priority attem

<SourcePR number="11791" title="Make directRenderScript the default"/>

In Astro v4.x, `experimental.directRenderScript` was an optional flag to directly render `<scripts>` as declared in `.astro` files (including existing features like TypeScript, importing `node_modules`, and deduplicating scripts). This strategy prevented scripts from being executed in places where they were not used.
In Astro v4.x, `experimental.directRenderScript` was an optional flag to directly render `<scripts>` as declared in `.astro` files (including existing features like TypeScript, importing `node_modules`, and deduplicating scripts). This strategy prevented scripts from being executed in places where they were not used. Additionally, conditionally rendered scripts were previously implicitly inlined, as if an `is:inline` directive was automatically added to them.

Astro 5.0 removes this experimental flag and makes this the new default behavior in Astro: scripts are no longer hoisted to the `<head>`, multiple scripts on a page are no longer bundled together, and a `<script>` tag may interfere with CSS styling.

Additionally, conditionally rendered scripts were previously implicitly inlined, as if an `is:inline` directive was automatically added to them. In Astro 5, this behavior is no longer implicit.
Astro 5.0 removes this experimental flag and makes this the new default behavior in Astro: scripts are no longer hoisted to the `<head>`, multiple scripts on a page are no longer bundled together, and a `<script>` tag may interfere with CSS styling. Additionally, conditionally rendered scripts are no longer implicitly inlined.

#### What should I do?

Please review your `<script>` tags and ensure they behave as desired.

If you previously had conditionally rendered `<script>` tags, you will need to add an `is:inline` attribute to preserve the same behavior as before:

```astro title="src/components/MyComponent.astro" ins="is:inline"
Expand All @@ -554,8 +554,6 @@ const { showAlert } = Astro.props;
}
```

Please review your `<script>` tags and ensure they behave as desired.

<ReadMore>Read more about [using `script` tags in Astro](/en/guides/client-side-scripts/#using-script-in-astro).</ReadMore>

## Breaking Changes
Expand Down

0 comments on commit 1c24751

Please sign in to comment.