Project Moved to Vitest Monorepo
Vite as Node runtime.
EXPERIMENTAL
npx vite-node index.ts
Options:
npx vite-node -h
- Out-of-box ESM & TypeScript support (possible for more with plugins)
- Top-level await
- Vite plugins, resolve, aliasing
- Respect
vite.config.ts
- Shims for
__dirname
and__filename
in ESM - Access to native node modules like
fs
,path
, etc. - Watch mode (like
nodemon
)
- Production, yet - in very early stage, check it later
- Most of the time, when other tools can do that job
- We need to start a Vite server upon each execution, which inevitably introduces some overhead. Only use it when you want the same behavior as Vite or the powerful plugins system (for example, testing components with a Vite-specific setup).
It runs Vite's id resolving, module transforming, and most importantly, the powerful plugins system!
It fires up a Vite dev server, transforms the requests, and runs them in Node.
Based on @pi0's brilliant idea of having a Vite server as the on-demand transforming service for Nuxt's Vite SSR.
Thanks @brillout for kindly sharing this package name.
MIT License © 2021 Anthony Fu