-
-
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
Vite #409
Merged
Merged
Vite #409
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* WIP vite prod builds * prettier * HN example working, at least * fix some stuff * update config files * various * simplify * simplify * oops * fix find_layout * remove logging * fix vite base path * make vite a peer dependency * let vite serve static assets * get SSR CSS working * remove unused code * rename CLI * simplify configs * tweak relationship between different packages * simplify app-utils * update tests to remove app startup crashes in prod * fix lockfile * tweak some file locations etc, get some more tests passing * get tests passing * update lockfile * update lockfile * get all tests passing, locally at least * remove snowpack-related stuff * add vite-plugin-svelte to monorepo * lint * dont remove styles, it breaks stuff. TODO investigate * Upgrade vite * fix some sourcemap stuff * remove vite-plugin-svelte from workspace until things settle down more * fix lockfile * gloss over import.meta transform bug for now * hack around vite bugs until 2.0.4 * only lint src files * remove source-map-support, it was causing weird stuff to happen * ensure renderer waits for layout/error styles * i really dont understand this lockfile bollocks * Upgrade to vite 2.0.4 * add fork of @svitejs/vite-plugin-svelte back to monorepo * lint * make run in node 12 * ffffuuuuuuu * Fix file path * specify vite 2.0.4 everywhere * add some logging to try and diagnose CI test failures * fix output directories * remove logging Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
benmccann
approved these changes
Mar 1, 2021
3 tasks
For future historians: this PR dropped |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR switches the build system underlying SvelteKit, from Snowpack to Vite. This isn't a decision we're taking lightly, but after careful analysis we feel that it's the right one — while we had misgivings about Vite 1 (which gave Vue apps preferential treatment, and didn't really support SSR), Vite 2 does a really great job of solving some tricky problems that were previously in SvelteKit's domain, like CSS code-splitting or fixing stack traces during SSR. Since it's Rollup-based, it also means that SvelteKit apps can benefit from the very large ecosystem of Rollup plugins.
I did some spot checking on how this would affect things like build time and bundle sizes. I wasn't scientific about it and didn't take extensive notes, but the upshot was that Vite was slightly ahead on both fronts, but not to the extent that it was a significant factor in the decision.
Since Reddit code historians and others will no doubt find this PR once the repo goes public, I'll take this opportunity to make clear that we still think Snowpack is an excellent tool with a bright future. The only thing that has changed here is that Vite 2 came out and is uncannily well-designed for the details of the problems we're trying to solve, and we have a responsibility to pick the most appropriate tool for the job. (At present! We can expect more evolution in the unbundled dev server arena.)
One notable thing about this PR: it includes a
@sveltejs/vite-plugin-svelte
package, which is a fork of @dominikg's plugin that I added temporarily to work around a caching bug we found. In all likelihood we'll want to have some form of Vite plugin in this repo on a permanent basis, but it's not yet totally clear what that looks like — Dominik justifiably wants to keep the Svite plugin in an open repo, and this repo isn't open just yet. There's also rollup-plugin-svelte-hot; @rixo makes the point that we could potentially merge the Rollup and Vite plugins to the benefit of all (e.g. the Rollup plugin doesn't currently readsvelte.config.js
files). (It's a Vite plugin rather than a plain Rollup plugin because we need extra Vite-specific logic to take advantage of the HMR capabilities.) The good news is that this is a minor implementation detail from the perspective of SvelteKit users, and can be swapped around easily.