0.1.5 • Published 4 months ago

vite3-plugin-express v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

vite3-plugin-express

A simple plugin for express that runs an express node js server from within vite

How to use:

In vite.config.ts

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import express from "vite3-plugin-express"

export default defineConfig({
  plugins: [vue(), express('express-server.ts')]
})

example express app file express-server.ts

import express from "express"; 

export const app = express(); // the express handler should be exported as app

if (!process.env['VITE']) // When running from `vite` there is no need to call `app.listen`
  app.listen(3002, () => console.log("Started"));
  • Make sure that the express handler is exported as app
  • Make sure not to call app.listen.

    The plugin adds the VITE environment variable, use that to disable the call to app.listen

0.1.4

4 months ago

0.1.5

4 months ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.4

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago