-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
SvelteKit 2 does not transform logical assignments with es2015 target #11658
Comments
Note that the vite config kit/packages/kit/src/exports/vite/index.js Line 648 in 5dae367
|
Related #12 |
What I'm doing right now on a project that I haven't yet upgraded to SK v2 is an inline Vite plugin defining a I briefly tried upgrading to SK v2 and it looks like this is still working, although I don't know what other implications it might have on the features that resulted in that |
We have users with Firefox 78.15, in general people with old machines that won't allow modern browser updates. This version is a couple of years old, and our app crashes in their browsers with the upgrade to SK2, which is not reasonable. We should be able to decide the build target for ourselves. |
v1 did not supply a default target: kit/packages/kit/src/exports/vite/index.js Line 573 in 0f71007
Using It looks like the default of |
Ah, interesting — very possibly, yeah. We should try it and see if anything breaks. Do we want to enforce |
The fix for this issue breaks some prod builds when upgrading from <=2.4.0 to 2.4.1, and top level await is used in modules. See repro here.
If you downgrade Sveltekit to 2.4.0, prod build finishes successfully. |
Sorry for the breakage @LoremFooBar. You can fix it by setting |
Thanks, do you have any reference for that bug? |
Describe the bug
SvelteKit 2 does not seem to transform production code correctly when
build.target
is set toes2015
invite.config.js
.The following error pops up in the console when opening the demo app in a browser that does not support Logical assignments:
SyntaxError: expected expression, got '='
This is due to the presence of a
de||=Promise.resolve()
in the built code, even though the build target is set toes2015
.A fresh vanilla Vite 5 project with
es2015
target does not reproduce this, and works as it should, transforming logical assignments as expected.Reproduction
Repo is here: https://github.com/bleucitron/sk2-transform-bug
Run
de||=
in the.svelte-kit
folderor
Open built app in a browser that does not support logical assignment syntax (Firefox 78.15 in my tests, you can find sources here)
Open the console, and witness the error
Logs
No response
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: