-
-
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
Sveltekit support for Deno in dev #8324
Comments
Rather than introducing new config I wonder if we could do this automatically. E.g. we could check for |
The above is a more explicit check if the local fetch is undici and it's a bit brittle. a more generic node runtime check would be if we want to detect deno at buildtime, it could be done with
(https://github.com/svitejs/node-conditions/tree/main/packages/node-conditions) |
I don't know if detecting at buildtime would work. There's just one version of the SvelteKit dev server whether you're running Node or Deno. But presumably Though I also found
Then we'd only have to force-polyfill the versions of Node with broken versions of Undici. |
Describe the problem
A couple of releases ago, deno realesed npm support, so you can use svelte + vite in deno. Sveltekit however gives an error as following when you visit the page in the browser and the page won't load.
As you can see below, a deno maintainer found that the issue was that sveltekit was polyfilling apis here from undici. They don't work quite the same as those apis in deno causing the error. Polyfills are injected here:
kit/packages/kit/src/exports/node/polyfills.js
Lines 6 to 28 in e7bc0be
More details are in his issue in the deno repo: denoland/deno#17248
Describe the proposed solution
My suggestion is to add some kind of option to avoid these polyfills all together. I did see #7668 which led to #7673 which led to it being reverted in #7675 . As I understand it this would not inject them when an api was already in globalThis, but what I'm instead suggesting is a manual option so that we can choose not to override the globals, probably in svelte.config.js.
It could for example be
const config = {
injectGlobals: false
}
Alternatives considered
As I understand it currently the node adapter is used for dev, perhaps there is some way to switch this out for a official deno adapter which unlike the one on npm also runs in dev but currently I don't see the need for this as this, making a whole new adapter just for changing one file.
Importance
i cannot use SvelteKit without it
Additional Information
The importance more means I cannot use sveltekit in deno without it.
The text was updated successfully, but these errors were encountered: