Closed brillout closed 1 year ago
When running
deno run -A --node-modules-dir npm:vite
, will vite be using Node in any way under the hood? I noticed that Bun for now has a --bun flag specifically to make sure that Vite isn't using node under the hood, but I don't know what is the case for deno.As far as I know Vite will run fully in Deno.
I don't think it always does, I'm getting import errors, same as with bun (without --bun
flag)
Like this:
[vite] Error when evaluating SSR module C:/Source/JavaScript/solid-start-test/deno-solid-test/src/routes/index.tsx?pick=default&pick=$css: failed to import "jsr:@db/sqlite@0.12"
Indicating that it is not using deno, because deno knows how to import from jsr.
Update It might be that vinxi, that is now popular way to run vite's dev server doesn't support deno 😢
When running
deno run -A --node-modules-dir npm:vite
, will vite be using Node in any way under the hood?I noticed that Bun for now has a --bun flag specifically to make sure that Vite isn't using node under the hood, but I don't know what is the case for deno.
As far as I know Vite will run fully in Deno.
I don't think it always does, I'm getting import errors, same as with bun (without
--bun
flag)Like this:
[vite] Error when evaluating SSR module C:/Source/JavaScript/solid-start-test/deno-solid-test/src/routes/index.tsx?pick=default&pick=$css: failed to import "jsr:@db/sqlite@0.12"
Indicating that it is not using deno, because deno knows how to import from jsr.
Update It might be that vinxi, that is now popular way to run vite's dev server doesn't support deno 😢
Vite is a bundler, no matter if you run in with node, deno or bun, if vite doesn't understand how to resolve imports it won't work.
Here es the deno vite resolver for jsr imports https://github.com/denoland/deno-vite-plugin
It does run in Deno! So I had an npm script like this:
"vite": "vite"
running deno task vite
fired it up and it ... just worked? So I came here wondering if Vite was running a node child_process under the hood - it's not!
Confirmed by opening up my activity monitor - ensuring no node
or deno
processes were running. Upon starting - it fires up two deno processes.
Problem is that vite doesn't support JSR imports, it just appears as same kind of error as bun without --bun
switch, I made a pull request: https://github.com/vitejs/vite/pull/18479
Problem is that vite doesn't support JSR imports, it just appears as same kind of error as bun without
--bun
switch, I made a pull request: https://github.com/vitejs/vite/pull/18479
Does the deno resolver doesn't work for you? https://github.com/denoland/deno-vite-plugin
Problem is that vite doesn't support JSR imports, it just appears as same kind of error as bun without
--bun
switch, I made a pull request: vitejs/vite#18479Does the deno resolver doesn't work for you? https://github.com/denoland/deno-vite-plugin
I tried with the deno vite plugin with a Vinxi project shared with @Ciantic and It did not worked, there is an issue to track tho https://github.com/denoland/deno/issues/26569
Is supporting Vite on Deno's radar?
Although many Node.js libraries already work with Deno, Vite is a whole different beast and probably needs changes on Deno's side.
Note that it's not only about supporting Vite, but also its entire ecosystem (SvelteKit, vite-plugin-ssr, etc.).
FYI Bun is working on supporting Vite: https://github.com/oven-sh/bun/issues/250#issuecomment-1195153860.