Vite can support deno runtime?
Vite already write on Typescript. But it still need running with npm. How to Setup running vite with deno?
Thx
Deno has a completely different runtime semantics and none of the npm dependencies that Vite relies on. It's also too early stage at this time.
@yyx990803
But it's also a great chance to make Deno more popular if popular JS libraries like Vue/Vite could support Deno (or at least be compatible with Deno). One of the biggest pain I found in the Node.js ecosystem is that there are too many NPM packages depends on commonjs and use require('...')
dynamically, therefore those packages can't work well with bundlers like Rollup (and now Vite either).
Since Vite is a brand new project and there is no historical baggage for Vite, Why not embrace a brand new ecosystem without the commonjs issues and more friendly for TypeScript? I think it could be meaningful for both Vite and Deno.
It actually works already (you just need to do little change locally) https://github.com/vitejs/vite/issues/714
@cztomsik I think that's an entirely different use of deno and vite together than what this issue is about. Both are valuable. I am pretty sure this issue is about running a vite server with Deno. Yours is about importing the output of the Vite server into Deno. I think maybe your particular issue should be fixed by Deno rather than Vite. If you can't convince them because their idea of zero-config means importing something without an extension will always assume it's TypeScript, well that's too bad for the Deno project.
@cztomsik not all is lost if Deno won't make that change, though - I think a vite plugin might be able to make it work, and if not, perhaps a separate PR that would make the plugin system powerful enough to allow this would get merged in.
@benatkin correct, I found this issue and posted here not reading too much if it's server or client.
- server-side might work in future when used with this)
- client-side works already even without the change (I am using it occasionally)
vite distingue two thing deps and src code vite transform node to esm module in node/.vite directory this step not needed in deno ecosys because we all or most npm pkg transformed to esm in skypack.dev (for exemple ) and we don't to do it in our local machine but scr bundle on the fly is usefull for deno-frontend if is possibke
I think perhaps that generating code to be run by Deno is just as outside of scope for Vite as getting it to run on Deno. It probably would be useful for Deno to have something like Vite to bundle modules, but it isn't aligned with the goals of Vite.
I'm interested in both Vite and Deno, and I think it would be interesting if a new project were built for Deno that is similar to Vite. Since it would have its own goals, the developers could design it to build code to run on Deno in addition to browsers.
@benatkin I don't know if it's similar somehow to Vite (because I'm still testing it) but there is this alternative: https://github.com/open-source-labs/vno