Vite Plugin Node
A vite plugin to allow you to use vite as node dev server.
Why?
- While frontend development tooling is evolving rapidly in recent years, backend DX is still like in stone age. No hot module replacement; Typescript recompiling slow as funk; Lack of plugin system etc. Thanks to Vitejs created by Evan You (a.k.a creator of vuejs; my biggest idol developer), makes all those dreams for backend development come true!
Get started
-
Install vite and this plugin with your favourite package manager, here use npm as example:
$ npm install vite vite-plugin-node -D
-
Create a vite.config.js
file in your project root to config vite to actually use this plugin:
import { VitePluginNode } from 'vite-plugin-node';
const config = {
plugins: [
VitePluginNode({
server: 'express',
appPath: './app.ts',
port: 3000,
tsCompiler: 'esbuild',
createCustomServer: () => IServer
})
]
}
export default config;
-
Add a npm script to run the dev server:
"scripts": {
"dev": "vite-node"
},
To-Do
As this plugin just fresh developed, there are still lots ideas need to be implemented, including:
Bugs
Create an issue if you found any bugs to helpe me to improve this project