Skip to content
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 6 #12270

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Vite 6 #12270

wants to merge 8 commits into from

Conversation

benmccann
Copy link
Member

Experimental. WIP

Copy link

changeset-bot bot commented May 29, 2024

⚠️ No Changeset found

Latest commit: 0b75723

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@benmccann
Copy link
Member Author

I think there's a few errors here, but the biggest seems to be that Vite 6 is treating all .json files as being a tsconfig.json and then reloading the server when such a file changes. @dominikg had a PR out for this here: vitejs/vite#17317

@benmccann
Copy link
Member Author

benmccann commented Aug 24, 2024

The changes to the esbuild plugin have been reverted so the prior issue with tsconfck is gone. We're down to two errors now:

  [chromium-dev] › client.test.js:448:2 › Invalidation › server-only load functions are re-run following forced invalidation 
  [chromium-dev] › client.test.js:461:2 › Invalidation › server-only load functions are re-run following goto with forced invalidation 

This can be reproduced locally by running playwright on just that one test (just need to do pnpm install beforehand):

packages/kit/test/apps/basics$ pnpm test:dev -g "server-only load functions are re-run following forced invalidation"

This is the line that's failing while running this route:

expect(await page.textContent('h1')).toBe('a: 0, b: 1');

@eltigerchino
Copy link
Member

eltigerchino commented Aug 25, 2024

It seems that Vite is loading the same module twice: once by the +layout.server module, then again by the +page.server module. However, it should only be loaded once by +layout.server then re-used by +page.server so that they are both incrementing the same count variable.

You can test this by adding a console.log(count) statement at the top level, spin up a dev server, and see it log twice when you access the page for the first time.

https://github.com/sveltejs/kit/blob/main/packages/kit/test/apps/basics/src/routes/load/invalidation/forced/state.js

@patak-dev
Copy link

SvelteKit is now green in vite-ecosystem-ci. Upgrading to [email protected] should work out the issues in this PR.

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

Successfully merging this pull request may close these issues.

3 participants