sveltejs / svelte

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

Unable to handle `@` in attribute values since Svelte v3.12.0 #3545

Closed antony closed 5 years ago

antony commented 5 years ago

Describe the bug It seems that after upgrading to Svelte 3.12.0, using an @ in an attribute value causes a compiler error on the client.

This works as expected in 3.11.0

Logs

> TODO@0.0.1 dev /home/ant/Projects/martin-clunes
> sapper dev

✗ client
compiler error: this shouldn't happen! generated code is trying to use inexistent internal 'martin_clunes'
✔ server (846ms)
✔ service worker (439ms)
> Listening on http://localhost:3003

To Reproduce https://github.com/beyonk-adventures/sapper-attribute-issue

Expected behavior The bundle should compile correctly.

Information about your Sapper Installation:

Severity It's annoying and broken, but can be worked around temporarily.

Additional context This only occurs in Sapper projects, yet occurs on the client-side build.

Conduitry commented 5 years ago

This is almost certainly a bug in Svelte and not in Sapper, although I'm not sure why I'm having trouble reproducing it with Svelte alone. Moving the issue to the Svelte repo.

Conduitry commented 5 years ago

Whoops, I was thinking in a box. This reproduces it in the REPL, when compiled with dev mode on:

<Foo bar="@baz">
</Foo>

The reference to this.comment here needs to have @ sigils escaped, like it does down here.

Conduitry commented 5 years ago

I should've written a test when I fixed this the first time in #3186, maybe then this wouldn't have snuck through 😬

antony commented 5 years ago

@Conduitry wow - I reviewed all the commits and I didn't spot this :)

Conduitry commented 5 years ago

Fixed in 3.12.1.

jhwheeler commented 5 years ago

@Conduitry This still happens for me, even after updating to 3.12.1. Could it be because Sapper still uses 3.6.9?

Conduitry commented 5 years ago

The devdependency of "svelte": "^3.6.9" in Sapper won't have any effect on what version of Svelte it's using in your installation. What does running npm ls svelte display?

jhwheeler commented 5 years ago

We're using 3.12.1.

Conduitry commented 5 years ago

If you have a small repro, please open a new issue with it.