Commit activity
Last 12 weeks · 1 commit
Community health
3 of 6 standards met
Recent PRs & issues
Fixes #10. vite-node ran callbacks after Promise/ callbacks, violating Node's documented event-loop guarantee. Repro: prints , vite-node printed . Root cause: executes the transformed module body inside an async IIFE that is awaited from within a deep promise chain, so the module's top-level synchronous code runs inside V8's microtask checkpoint — Promise/queueMicrotask callbacks it registers drain before its callbacks. Fix (in only): execute the module body on a macrotask instead of awaiting it synchronously, mirroring how native CommonJS entry modules run. The error path is safe: the module body is wrapped in an async IIFE, so never throws synchronously and adopts rejections correctly; the cleanup still runs. Tests: new fixture (the exact repro) and (1 regression test). The test asserts the deterministic part only — output starts with , N before P and N before Q. It deliberately does not assert T-vs-I ordering (timer vs check phase is flaky under load; documented in the test comment). Full suite: 7 files / 35 tests passed, 0 failed. Build clean (, tsdown, eslint). Note: unrelated to #8 (which has its own repro-test PR #9) and to #18 (filed separately as #20).
Fixes #18. Glob import failed when a Vite config set a custom (e.g. ). Root cause: the constructor stored relativized against via . With a custom root that value becomes something like , which never substring-matches the absolute optimized-dep id — so the cacheDir branch in never fired, vite-node skipped the wait, and the dep was native-imported before Vite's optimizer wrote (). This is a vite-node bug, not a Vite bug (Vite's dev server serves/optimizes on demand and is unaffected). Fix (in only): store cacheDir absolute (, guarded by ), and normalize the id with instead of so an absolute id outside a custom root is left intact. The now-unused / imports are removed. Tests: new in (2 tests). Verified the tests are genuine regression tests: against base they fail exactly those 2 tests and pass the other 8. Full suite: 6 files / 36 tests passed, 0 failed. Build clean (, ). Note: this is unrelated to #8 (which has its own repro-test PR #9).
in built dump filenames from the full sanitized module id with no length cap, so a very long id crashed with when writing under (reported as vitest-dev/vitest#7744, where a long test-file path produced a filename like ). The fix caps the filename at 200 bytes: a new constant; names that fit are returned unchanged, otherwise the sanitized prefix is sliced so is exactly 200 bytes. The deterministic suffix is kept, so distinct long ids still map to different files. The sanitized alphabet () is ASCII-only, so bytes === chars, and negative hashes (e.g. , the double dash in the reported filename) are handled by the length math. Short ids are byte-identical to before. Note: Vitest 4 no longer depends on vite-node (it moved to Vite's Module Runner), so this fix is for vite-node itself and its other consumers; the reported crash came through Vitest's when it still used vite-node. Verification New (4 tests): long-id length cap (byteLength ≤ 200 and < 255); / round-trip with a very long id; two distinct long ids sharing a 400-char prefix produce different filenames, both within limits; three short ids encode byte-identical to the pre-fix formula (hashes independently recomputed). Full suite: 7 test files passed, 38 tests passed, 0 failed (independently re-run). Typecheck () exits 0; lint on both changed files exits 0; build () succeeds. Ref vitest-dev/vitest#7744
Recent fixes
This project is firstly inspired by Nuxt 3's SSR implementation made by @pi0, as a PoC. Later, it made Vitest possible by providing the same pipeline as in Vite. It served the ecosystem well for a few years and later became a more generalized built-in solution as Vite Environment Module Runner. Vitest has https://github.com/vitest-dev/vitest/pull/8208, which means vite-node has finished its mission. We will still keep it around for the ecosystem that built around it, but for new projects, please consider using the builtin Vite one instead. How do I migrate to the Vite Environment Module Runner? Are there any examples? How do I use the Vite Environment Module Runner to run or bundle arbitrary typescript scripts for Node.js?
Please be aware that vibe-coding contributions are 🚫 STRICTLY PROHIBITED. We are humans behind these open source projects, trying hard to maintain good quality and a healthy community. Not only do vibe-coding contributions pollute the code, but they also drain A LOT of unnecessary energy and time from maintainers and toxify the community and collaboration. All vibe-coded, AI-generated PRs will be rejected and closed without further notice. In severe cases, your account might be banned organization-wide and reported to GitHub. PLEASE SHOW SOME RESPECT and do not do so. Before submitting the PR, please make sure you do the following: Read the Contributing Guide. Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate. Provide a description in this PR that addresses what the PR is solving and WHY**, or reference the issue that it solves (e.g. ). Ideally, include relevant tests that fail without this PR but pass with it. [x] Linked Issues https://github.com/nuxt/nuxt/issues/33917 Additional context
Repository: made-in-common/vite-node. Description: Vite as Node.js runtime Stars: 491, Forks: 13. Primary language: TypeScript. Languages: TypeScript (97.6%), JavaScript (2.4%), CSS (0%). License: MIT. Topics: node, runtime, vite. Latest release: v6.0.0 (8mo ago). Open PRs: 4, open issues: 4. Last activity: 1d ago. Community health: 50%. Top contributors: sheremet-va, antfu, renovate[bot], hi-ogawa, Dunqing, AriPerkkio, sxzz, patak-cat, btea, poyoho and others.