-
-
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
Cannot build SvelteKit app with @vitejs/plugin-legacy
#3247
Comments
I can't reproduce this. Note that I ran
|
@benmccann, you are not reproducing the bug because by running Note that in order to initially install the older SvelteKit libs to create my example repo, I had set the dependencies like so in the package.json:
I have updated So you can run this below like you did, and you'll now reproduce the error:
Thanks. |
Ah, ok. Sorry about that. I'm not used to packages being pinned in Anyway, it's reproducing now and I can see the exception being thrown from this line:
|
@vitejs/plugin-legacy
The issue appears to be that SvelteKit assumes Vite will return a single object, but |
It's not really clear to me how we would easily make this work. I think this is part of a larger effort supporting legacy builds, so I close this as a duplicate of #12 |
Sure, thanks for you feedback @benmccann and the time to dive into the issue. Actually I wrote the reproduction procedure that way to show that the build error only appears when I upgrade to latest SvelteKit. Note that the So it might be something related to SvelteKit I guess, as only SvelteKit libs have changed when the build is failing... See below by using
Maybe I am missing something along the way here, though. Btw I am using @vitejs/plugin-legacy to generate legacy chunks along the ones generated by default by Vite. I am trying to write a custom adapter-static-legacy that could generate proper HTML targeting those chunks, which would enable support of legacy browsers for statically-built SvelteKit apps (before full legacy support is implemented, as in #12). |
It would have likely broken as a result of #2931. I'm afraid that's a rather large change and it's not immediately clear to me how you'd make |
@benmccann sure no prob, thank you for your quick feedbacks. I'll thus try to come up with new ideas to create legacy builds for static apps. Probably by re-processing the output folder coming out from adapter-static, to turn it legacy-browsers-friendly. Will post about it if I ever come up with something successful. Cheers |
Same problem here. As @benmccann pointed out, the issue is My goal is to support legacy Safari on iPhone 4s. |
Should this ticket be closed if the issue isn't fixed? Are there any other ways to support legacy browsers with Sveltekit? If not, this is a blocker for me. |
As I said when this was closed, we already have an issue to track this. Please follow #12 |
@nicomouss Did you find a workaround for this? |
Any updates on this? |
Describe the bug
In case some Vite plugins are set in the config, command
npm run build
fails using latest SvelteKit version, whereas it was not failing using older versions.Reproduction
This successfully builds a basic SvelteKit skeleton app (with a Vite plugin added to its build config) based on a previous version of SvelteKit. You can check the libraries in use by running
npm list --depth=0
, this should displays the following (= the setup you would have gotten by creating a SvelteKit app a couple weeks ago, like I did back then):Now let's upgrade our app to the latest version of SvelteKit (= the setup you would get by creating a SvelteKit app as for now):
Then run
npm run build
.The build now fails with the following exception:
Thus upgrading to latest SvelteKit version can break the build of an app.
In this case, there seems to be a side effect regarding Vite plugins. Because if you open
svelte.config.js
and change it from this:to this:
Then the build works successfully again. Only you loose the plugin you have been successfully using till now...
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: