You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Virtual module imports break esbuild dependency optimization when vinext is installed from npm #1
When vinext is installed as an npm package (rather than a symlinked local dependency), vite dev fails with:
✘ [ERROR] Could not resolve "virtual:vinext-rsc-entry"
node_modules/.pnpm/vinext@0.0.1_.../node_modules/vinext/dist/server/app-router-entry.js:15:23:
15 │ import rscHandler from "virtual:vinext-rsc-entry";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~
This happens during esbuild's dependency optimization pass. The optimizer scans vinext/dist/server/app-router-entry.js, encounters the virtual:vinext-rsc-entry import, and fails because virtual modules only exist at Vite plugin resolution time — not during esbuild's pre-bundling scan.
Why this wasn't an issue before
When vinext is a symlinked package ("vinext": "link:../vinext/packages/vinext"), Vite automatically excludes linked packages from dependency optimization. Once installed from npm ("vinext": "^0.0.1"), esbuild starts scanning it and hits the unresolvable virtual imports.
The error occurs in multiple Vite environments (client, rsc, ssr) since app-router-entry.js can be pulled into the dep optimization graph from any of them.
Proposed fix
The vinext plugin should add an esbuild plugin in its config() hook to externalize its own virtual modules during dependency optimization:
// In the vinext plugin config() hookconfig(){return{optimizeDeps: {esbuildOptions: {plugins: [{name: "vinext-externalize-virtual",setup(build){build.onResolve({filter: /^virtual:vinext-/},(args)=>({path: args.path,external: true,}));},}],},},};}
This is targeted — it only externalizes vinext's own virtual:vinext-* modules during the esbuild scan, without affecting pre-bundling of anything else.
An alternative (less targeted) approach would be to add "vinext" to optimizeDeps.exclude for all environments, but this prevents pre-bundling of all vinext exports even when unnecessary.
Activity
fix: exclude vinext from optimizeDeps to prevent virtual module resol…
fix: exclude vinext from optimizeDeps to prevent virtual module resol…
feat: App Router production server (vinext start)
feat: Pages Router client hydration on Cloudflare Workers + Cloudflar…
fix: 9 self-review bugs in static prerender build
fix(app-router): hard-navigate to browser URL on non-ok RSC fetch (#875)
fix(shims): extend unstable_rethrow + make unstable_retry functional
fix(shims): add unstable_catchError, unstable_rethrow, unstable_isUnr…
fix(app-router): track searchParams access for static bailout (#1788)
fix(otel-tracer-extension): address bonk review findings
fix(app-router): extend OTel tracer provider for Cache Component span…