Open jakubdonovan opened 1 year ago
Any script using npm
will be using Node by default. NPM is the "Node Package Manager"
Deno will only work in production when you've run npm run build
and have started the resulting server with something along the lines of deno run -A build/index.js
Note: the above script bypasses a lot of the security of Deno, you'll want to use more granulated permissions like with the following command: deno run --allow-net --allow-env --allow-read build/index.js
To reiterate though, the adapter can't be used for development... It can only help output files used in production
That being said, some more context on what you're trying to do would be helpful as it's likely something unrelated. If you have a repo I could check out, I'd be happy to take a look!
To add a little bit to what @brocococonut mentioned, this might change in the future, with the recent stabilization of npm support in Deno, and in particular with them getting Vite successfully running in Deno: https://deno.com/blog/v1.28 https://github.com/bartlomieju/vite-deno-example
Both should make it possible to run the end-to-end development process using Deno, but that is of a wider scope than what I had planned for this adapter. Related discussion in the past: https://github.com/pluvial/svelte-adapter-deno/issues/6
that is of a wider scope than what I had planned for this adapter.
Has your stance on this changed somewhat? I see the repo description now says βA SvelteKit adapter for Denoβ, with a tag to match π
@erlend-sh now that the Deno team have managed to get Vite itself running under Deno's compatibility layer for Node, I think it's worth trying to get the whole thing running end-to-end in Deno, yes.
However, that may not necessarily result in any changes to this adapter specifically, as it is still "only" a SvelteKit adapter, and as such is Node-first. For example, when using the adapters for Cloudflare, Vercel, Netlify, etc., the development experience doesn't change, vite dev
will still run in Node as usual, only the production build is targeted for a specific environment. In that sense, the primary goal of svelte-adapter-deno
is aligning with whatever the other official @sveltejs/adapter-*
are doing, not exactly doing the full "SvelteKit on Deno" experience which is what I understand you're asking for π
@erlend-sh now that the Deno team have managed to get Vite itself running under Deno's compatibility layer for Node, I think it's worth trying to get the whole thing running end-to-end in Deno, yes.
However, that may not necessarily result in any changes to this adapter specifically, as it is still "only" a SvelteKit adapter, and as such is Node-first. For example, when using the adapters for Cloudflare, Vercel, Netlify, etc., the development experience doesn't change,
vite dev
will still run in Node as usual, only the production build is targeted for a specific environment. In that sense, the primary goal ofsvelte-adapter-deno
is aligning with whatever the other official@sveltejs/adapter-*
are doing, not exactly doing the full "SvelteKit on Deno" experience which is what I understand you're asking for π
So how do we get it sveltekit and deno running during live development now that vite works with deno?
@jakubdonovan after the architecture changes a few months ago, SvelteKit is now "just" a Vite plugin , so in theory if Vite runs fine under Deno, then you should just be able to run it with the SvelteKit plugin and it should work end-to-end in Deno. I haven't tried this myself, but I do want to experiment with that at some point.
@erlend-sh thank you for the pointer, I'm also tracking that issue and some of the discussion in the Deno Discord, after starting to experiment with SvelteKit on Deno here: https://github.com/jpaquim/sveltekit-deno
Unfortunately the patch in my repo still seems to be needed, as the PR mentioned in that issue doesn't seem to have fixed yet.
produces the following error