-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
fix(cloudflare): resolve conditions for svelte #487
fix(cloudflare): resolve conditions for svelte #487
Conversation
🦋 Changeset detectedLatest commit: 7ed4460 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess with #476, #410 resurfaced again and hasn't really been properly fixed. However, the behaviour now returns to the same as Vite 5 (and the previous major of the cloudflare adapter).
However, I don't know if this is the correct fix. We can't remove both "browser" and "node" conditions, either one needs to be enabled. I think I have to think a bit more about how to fix this first. There's an inconsistency where we're trying to use resolve conditions for Cloudflare (webworkers), but during dev, we're actually still running in node.
Blocking this for now but you can pin to the previous version that worked to workaround this at the meantime.
@bluwy I feel like this is a good enough workaround for now. Are there any hard reasons not to merge this? |
I prefer to do a proper fix once than constantly changing the conditions between releases, because merging this will also cause unexpected issues for already working libraries before |
Closing this as fixed by sveltejs/svelte#14779 (#485 (comment)) |
Changes
Fixes #485.
#476 added the
workerd
andworker
resolve conditions to fix the Vue build breaking. As this fix used thedefaultClientConditions
as a base it broke builds using Svelte. The client default conditions include thebrowser
condition, which makes Svelte use the client entry when server side rendering.I feel that the
defaultServerConditions
make the most sense as a default here, and with filtering out thenode
condition the Vue build will still work.Testing
Added usage of
setContext
andonMount
to the Cloudflare Svelte fixture.Without this fix the tests then fail. With the fix all tests pass.
Docs
Should not really affect anything as this is just a bug fix.