antfu / vite-node

Vite as Node.js runtime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

As a plugin (+ eventually merge into `vite`)

brillout opened this issue · comments

commented

In addition to the current CLI mode, how about also offering a plugin mode:

import { server } from 'vite-node/plugin'

export default {
  plugins: [server({
    entry: './path/to/server.js'
  })]
}

So that when calling

$ vite

it would apply vite-node to ./path/to/server.js.

I'd argue to eventually merge vite-node into vite. With our progress vitejs/vite#4921 Vite will have first-class support for Node.js and then it would be super neat to merge vite-node into vite; it will make Vite the standard way of using TypeScript for Node.js.