-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: correctly resolve $app/state on the server with Vite 5
#13181
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
Conversation
🦋 Changeset detectedLatest commit: 0c5ca07 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
if it is really resolved to the client implementation the needs debugging and a testcase. |
|
Teatcase would be overblown IMO, but I'll try to confirm if this fixes it. Maybe we need to switch to an approach similar to the others where we're leveraging the env package instead (or look what that package is doing to fix it) |
|
a testcase and running it with vite5 and vite6 is needed i believe. that should have been there in the first place to make sure the feature works. Also not sure if this needs a change in the sveltekit vite plugin or vite-plugin-svelte itself or neither and instead the virtual module resolving needs to check the ssr flag. also not sure why the initial value would be "example.com" in any case, it should take the value from the existing origin ? |
|
soo this seems to work in vite6 but fail in vite5. surprisingly trying to debug the resolve conditions in vite5 reveals that only the "svelte" condition is exposed in configResolved hook, but that can't be correct. default resolve conditions should include "browser" for client and "node" for ssr. Not sure if they are just not logged or something else is fishy, downgrading to vite 5.3 and vps 4.0 does not change this so not a recent regression. if this is a general issue with resolve conditions it needs fixing in vite or vite-plugin-svelte, but not in the sveltekit plugin. But the setup with a generated alias that reveals the path to a nested package.json with exports conditions is special, i am kind of surprised it works in vite6 even. Unfortunately i am out of time, hopefully this gives some pointers.
vite-plugin-inspect can show resolve results as well. |
|
merged #13192 so I'll close this — I assume either approach would have worked fine but it's nice to have the consistency. Would like to investigate using the package.json solution more broadly in SK3 |
fixes #13179
This PR backports the default value for Vite 6's
ssr.resolve.conditionsoptions so that it doesn't fallback toresolve.conditionswhich seemingly causes it to resolve to the browser conditional export.However, I'm not sure if these condition values are right. @dominikg probably knows better.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkNo test because it only happens on Vite 5 and our test suite is on Vite 6.
Changesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits