chore(vite): replace vite-node with Vite's native RunnableDevEnvironment#1717
Conversation
✅ Deploy Preview for cedarjs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Greptile SummaryReplaces
Confidence Score: 5/5The migration is safe to merge; both execution paths are guarded with isRunnableDevEnvironment checks and the new CJS compat plugin has graceful fallback on any parse or lexer failure. The vite-node removal is a clean like-for-like substitution: fetchModule/resolveId delegation is replaced by the native environment runner, and resolveExtension correctly handles the TS extension-mapping edge case. The only open question is whether cjs-module-lexer should be declared as a direct dep rather than relied upon as a Vite transitive dep. packages/vite/src/plugins/vite-plugin-cedar-cjs-compat.ts — verify the cjs-module-lexer fallback is acceptable for CJS packages that use exports.foo-style named exports exclusively (the object-literal fallback won’t detect those) Important Files Changed
Reviews (12): Last reviewed commit: "fix review comment" | Re-trigger Greptile |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 2s | View ↗ |
nx run-many -t build |
✅ Succeeded | 7s | View ↗ |
nx run-many -t test --minWorkers=1 --maxWorkers=4 |
✅ Succeeded | 1m 19s | View ↗ |
nx run-many -t test:types |
✅ Succeeded | 7s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-05-05 12:26:55 UTC
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t test --minWorkers=1 --maxWorkers=4 |
❌ Failed | 1m 14s | View ↗ |
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 2s | View ↗ |
nx run-many -t build |
✅ Succeeded | 18s | View ↗ |
nx run-many -t test:types |
✅ Succeeded | 7s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-05-05 10:05:41 UTC
…t plugin @rollup/plugin-commonjs requires Rollup's internal build context (isRequiredId, resolveRequireSourcesAndUpdateMeta) which doesn't exist in Vite 6's EnvironmentPluginContainer, causing all transforms to crash. Replace with a custom transform plugin that: - Detects CJS files by checking for module.exports / exports.x patterns - Wraps them with CJS globals (module, exports, require, __dirname, __filename) - Uses cjs-module-lexer (Vite transitive dep) to statically detect named exports - Re-exports named exports individually so callers can use destructuring
|
The changes in this PR are now available on npm. Try them out by running Or try it in a new app with |
…ent (#1717) Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>

Summary
vite-nodeis a separate package that replicates functionality now built directly into Vite via the Environment API (introduced in Vite 6, and we're on Vite 7).This replaces
ViteNodeServer+ViteNodeRunner+installSourcemapsSupportwith Vite's nativeRunnableDevEnvironment:Before:
After:
Files changed
packages/cli/src/lib/exec.js— used byyarn cedar exec(script runner)packages/prerender/src/graphql/node-runner.ts— used by prerender's GraphQL node runnerpackage.jsonfiles —vite-nodedependency removedInspired by
remix-run/react-router#14862
🤖 Generated with Claude Code