sveltejs / svelte

web development for the rest of us
https://svelte.dev
MIT License
79.7k stars 4.23k forks source link

import "with" attribute crashs #12551

Open Inqnuam opened 3 months ago

Inqnuam commented 3 months ago

Describe the bug

using with or assert in import attributes (import statement or dynamic import) crashs

Reproduction

<script lang="ts">
 import Miaou from "./cat.svelte" with { type: "animal" };
</script>

Logs

Unexpected token
import Miaou from "./cat.svelte" with { type: "json" };
                                    ^

System Info

svelte@4.2.18

Severity

annoyance

dummdidumm commented 3 months ago

We're using Acorn, which needs to implement the new syntax (which will likely only happen once it is Stage 4): https://github.com/acornjs/acorn/issues/1289

Until then you could

Inqnuam commented 6 days ago

@dummdidumm Acorn 8.14.0 is now released with support for with import attribute Could you please update Svelte 4 and 5 acorn dependencies ?