For frontend development we switched to vite/vitest retireing a melange of other tooling like jest mocha chai webpack etc. So I was thinking to apply it to node development. I started with vitest and GitHub copilot did a reasonable job matching the test syntax.
Next step is vite (love the hot reload). I was wondering if someone had tried this before and can share experience, successes, obstacles or failures?
I've not personally, I'm still stuck in the world of Gulp. Though I do now make extensive use of both ESBUILD, which I love for its ability to output working JavaScript/NodeJS set to a specific version, and LightningCSS which does the same for CSS.
Hot reload not really applicable generally I think? I use a watch function in PM2 (which I use to run my dev version of Node-RED) to restart Node-RED if appropriate files change. Nodes under development are simply installed from my dev source folders so it all just works.
I'd love to see some Vite config for node-red dev to see if it would be worth switching from Gulp which is a bit clunky - but works.
I enabled the official node-red test helper package to be used with vitest
Here is an example
Because I couldn't make Vite dev server serve Node-RED asssets, I decided to build my own cli. It is called nrg. It builds both client and server-side parts of the node using esbuild, html is processed by html-minifier, and css by postcss. You can use esbuild plugins to load other types of assets if you need. The nrg cli offers hard reload with watch mode, and dev debugging for both client and server side parts of a node. Because there is no official support to TS, I decided to not add support to it. Additionally, you will see that nrg enables node developers to create Nodes using classes
One of my goals for the nrg cli was to enable devs to build nodes using LWC/Vue/Svelte/React. However, I couldn't make it work because I realized I would have to rewrite all jquery widgets as components, and this is too much work.