Skip to content

style tag in string literal causes incorrect *{} injection into template during dev #1254

@ocavue

Description

@ocavue

Describe the bug

Given the following Svelte component

<main>
    <pre><code>{text}</code></pre>
</main>

<style>
  pre {
    color: green;
  }
</style>

<script lang="ts">
  let text = $state(`<style>Style3</style>`)
</script>

The *{} text (from compile.js#L67) is incorrectly injected into the app.

Image

Reproduction URL

https://stackblitz.com/edit/vitejs-vite-o39yk1ja

Reproduction

No response

Logs

N/A

System Info

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions