-
Notifications
You must be signed in to change notification settings - Fork 286
Published npm package ships sourcemaps pointing to missing source files #2
Copy link
Copy link
Closed
Description
Description
When vinext is installed from npm (vinext@0.0.1), Vite logs many warnings during dev:
Sourcemap for ".../node_modules/vinext/dist/server/image-optimization.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/server/app-router-entry.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/shims/navigation.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/shims/headers.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/shims/server.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/shims/metadata.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/shims/cache.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/utils/hash.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/shims/fetch-cache.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/shims/cache-runtime.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/shims/navigation-state.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/server/instrumentation.js" points to missing source files
Sourcemap for ".../node_modules/vinext/dist/shims/font-local.js" points to missing source files
Cause
The published dist/ directory includes .js.map files that reference the original TypeScript source files (via "sources" in the sourcemap JSON). However, the source .ts files are not included in the npm package, so Vite cannot resolve the sourcemap references.
This wasn't visible when using vinext as a linked dependency because symlinked packages resolve to the actual source tree where the .ts files exist.
Suggested fix
Either:
- Include source files in the npm package by adding
"src"to the"files"field inpackage.json(enables proper source-mapped debugging) - Set
"sourcesContent"in the sourcemaps so the source content is inlined into the.js.mapfiles (no separate source files needed) - Strip sourcemaps from the published package if they are not needed by consumers (remove
.js.mapfiles and//# sourceMappingURLcomments from.jsfiles)
Option 2 is the best balance — consumers get working sourcemaps for debugging without needing the raw source tree.
Impact
Harmless — these are warnings, not errors. The app runs fine. But it's noisy and clutters the terminal during development.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels