fix: inline source content in sourcemaps to prevent missing source warnings#5
Merged
southpolesteve merged 1 commit intomainfrom Feb 24, 2026
Merged
Conversation
…rnings When vinext is installed from npm, the .ts source files aren't in the package but .js.map files reference them, causing Vite to log many 'points to missing source files' warnings. Adding inlineSources: true to tsconfig embeds the original TypeScript source content directly in the .js.map files so no separate .ts files are needed. Fixes #2
|
southpolesteve
added a commit
that referenced
this pull request
Feb 27, 2026
Bundle middleware.ts into the server entry at build time via generateServerEntry(). The virtual module now imports the middleware file statically and exports a runMiddleware(request) function that includes matcher logic and NextRequest wrapping. In prod-server.ts, middleware runs before API route and page routing: - Redirects (e.g. /old-page -> /about) return 307 with Location header - Rewrites (e.g. /rewritten -> /ssr) transparently serve the target page - Blocks (e.g. /blocked -> 403) return the middleware Response directly - Response headers from NextResponse.next() are applied to all matched requests Also fixes server.listen() to be awaited (enables port: 0 for tests). When no middleware.ts exists, runMiddleware is a no-op stub. App Router middleware already works (bundled in RSC entry) — no changes needed. 12 new tests: 6 unit tests for runMiddleware exports, 6 integration tests using startProdServer with the pages-basic fixture. Closes #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When vinext is installed from npm, Vite logs many warnings during dev:
The published
dist/includes.js.mapfiles that reference the original.tssource files via"sources", but the.tsfiles aren't included in the npm package.Fix
Adds
"inlineSources": truetotsconfig.json. This tellstscto embed the original TypeScript source content directly in the.js.mapfiles viasourcesContent, so no separate source files are needed.Verified: after building,
.js.mapfiles now containsourcesContentwith the full original source.Fixes #2