Skip to content

import "with" attribute crashs #12551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Inqnuam opened this issue Jul 22, 2024 · 3 comments · Fixed by sveltejs/esrap#61
Closed

import "with" attribute crashs #12551

Inqnuam opened this issue Jul 22, 2024 · 3 comments · Fixed by sveltejs/esrap#61
Labels
compiler Changes relating to the compiler

Comments

@Inqnuam
Copy link

Inqnuam commented Jul 22, 2024

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

Severity

annoyance

@dummdidumm
Copy link
Member

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

Until then you could

@Inqnuam
Copy link
Author

Inqnuam commented Oct 27, 2024

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

@Conduitry Conduitry added compiler Changes relating to the compiler and removed blocked by upstream labels Nov 3, 2024
@Conduitry
Copy link
Member

Acorn now supports this, and Svelte no longer refuses to compile components with these imports, but the with clause is now silently dropped. I'm not sure where it's going to need to happen to preserve that. https://github.com/Rich-Harris/esrap ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Changes relating to the compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants