vite-plugin-node weekly downloads statistics
By axe-me · npm · Vite plugins
Vite plugin to enable your node server HMR
vite-plugin-node has 102,664 recorded weekly downloads on npm, a decrease of 12.5% over the past 30 days, ranking #635 of 3,247 tracked listings.
About vite-plugin-node
Vite Plugin Node
A vite plugin to allow you to use vite as node dev server.
Features
- All the perks from Vite plus:
- Node server HMR! (hot module replacement)
- Support Express, Fastify, Koa and Nest out of the box
- Support Custom Request Adapter
- You can choose to use
esbuildorswcto compile your typescript files
Get started
-
Install vite and this plugin with your favorite package manager, here use npm as example:
npm install vite vite-plugin-node -D -
Create a
vite.config.tsfile in your project root to config vite to actually use this plugin:import { defineConfig } from 'vite'; import { VitePluginNode } from 'vite-plugin-node'; export default defineConfig({ // ...vite configures server: { // vite server configs, for details see [vite doc](https://vitejs.dev/config/#server-host) port: 3000 }, plugins: [ ...VitePluginNode({ // Nodejs native Request adapter // currently this plugin support 'express', 'nest', 'koa' and 'fastify' out of box, // you can also pass a function if you are using other frameworks, see Custom Adapter section adapter: 'express', // tell the plugin where is your project entry appPath: './app.ts', // Optional, default: 'viteNodeApp' // the name of named export of you app from the appPath file exportName: 'viteNodeApp', // Optional, default: 'esbuild' // The TypeScript compiler you want to use // by default this plugin is using vite default ts compiler which is esbuild // 'swc' compiler is supported to use as well for frameworks // like Nestjs (esbuild dont support 'emitDecoratorMetadata' yet) // you need to INSTALL `@swc/core` as dev dependency if you want to use swc tsCompiler: 'esbuild', // Optional, default: { // jsc: { // target: 'es2019', // parser: { // syntax: 'typescript', // decorators: true // }, // transform: { // legacyDecorator: true, // decoratorMetadata: true // } // } //} // swc configs, see [swc doc](https://swc.rs/docs/configuration/swcrc) swcOptions: {} }) ] }); -
Update your server entry to export your app named
viteNodeAppor the name you configured.
ExpressJs
const app = express();
// your beautiful code...
if (import.meta.env.PROD) {
app.listen(3000);
}
export const viteNodeApp = app;
KoaJs
import Koa from 'koa';
const app = new Koa();
// your beautiful code...
if (import.meta.env.PROD) {
app.listen(3000);
}
export const viteNodeApp = app;
Cloud Functions
const app = async (req, res) => {
// your beautiful code...
};
export const viteNodeApp = app;
Fastify
import fastify from 'fastify';
const app = fastify();
// your beautiful code...
if (import.meta.env.PROD) {
app.listen(3000);
}
export const viteNodeApp = app;
if the app created by an async factory function you can just export the promise.
import fastify from 'fastify';
const app = async (options) => {
const app = fastify(options);
// app logics...
return app;
};
// note here we need to run the function to get the promise.
export const viteNodeApp = app(options);
NestJs
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
if (import.meta.env.PROD) {
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
bootstrap();
}
export const viteNodeApp = NestFactory.create(AppModule); // this returns a Promise, which is ok, this plugin can handle it
-
Add a npm script to run the dev server:
"scripts": { "dev": "vite" }, -
Run the script!
npm run dev
Custom Adapter
If your favorite framework not supported yet, you can either create an issue to request it or use the adapter option to tell the plugin how to pass down the request to your app. You can take a look how the supported frameworks implementations from the ./src/server folder.
Example:
import { defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';
export default defineConfig({
plugins: [
...VitePluginNode({
adapter: function (app, req, res) {
app(res, res);
},
appPath: './app.ts'
})
]
});
Build
This plugin leverages Vite SSR mode to build your app. All you need to do is add a build script to your package.json:
"scripts": {
"build": "vite build"
},
For more build config please check vite doc
Examples
See the examples folder.
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 Vite.js created by Evan You (A.K.A creator of vue.js; my biggest idol developer), makes all those dreams for backend development come true!
How?
---…
Description from the npm listing.
- vite
- vite-plugin
- node
- hmr
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (592)Similar npm Vite plugins plugins
All 20 vite-plugin-node alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/vite-plugin-node. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.