Using Deno 2 for simple HMR/static site dev server with Vite
We have a dead simple frontend which is 100% clientside. Just a folder of html files with some .ts imports.
We are trying to unify tooling around Deno 2, but haven't been able to get this working to develop our frontend. Are there docs (specifically for Deno 2.x) for Vite setup? I'm trying really hard to keep a simple Deno setup without re-introducing node/npm stuff (just a simple deno.json config) but can't seem to get Vite working.
With npm it was sufficient to just have a
vite [folder of html files]
dev script but no luck with Deno, can't escape unresolved dependency errors from Vite. I'd love a simple solution, it would be a shame to introduce a bunch more config for such a simple use case.2 Replies
I have the same issue, but it's a side project, so I won't progress.
What I have found:
- https://docs.deno.com/runtime/tutorials/how_to_with_npm/vue/
- https://docs.deno.com/deploy/tutorials/vite/ (simply just select vue in the vite setup)
Just please update how you progress!
A bit hard to tell the issue without some more information about the errors and config, but you may be missing the deno vite plugin: https://github.com/denoland/deno-vite-plugin (the readme has instructions for how to set it up). That allows vite to understand deno specific features (like import maps, deno.json, npm/jsr specifiers)
GitHub
GitHub - denoland/deno-vite-plugin: Vite plugin to enable Deno reso...
Vite plugin to enable Deno resolution inside vite. - denoland/deno-vite-plugin