Skip to content

Quiet optimized dependency sourcemap warnings#4646

Draft
lukemelia wants to merge 1 commit intomainfrom
cs-11019-quiet-ember-cli-warnings
Draft

Quiet optimized dependency sourcemap warnings#4646
lukemelia wants to merge 1 commit intomainfrom
cs-11019-quiet-ember-cli-warnings

Conversation

@lukemelia
Copy link
Copy Markdown
Contributor

Summary

  • Adds a serve-only Vite middleware that pads optimized dependency sourcemaps before Vite transforms the matching optimized dep JavaScript file.
  • Prevents Vite from hydrating missing sourcesContent entries from pnpm package paths outside packages/host/node_modules/.vite, which removes the repeated "Sourcemap for ... points to a source file outside its package" warnings.

Validation

  • Reproduced the warning with pnpm start in packages/host before the change.
  • Verified optimized dependency requests no longer print the sourcemap warning after the change.
  • Confirmed affected maps are padded so sourcesContent length matches sources length.
  • Ran mise exec -- pnpm lint in packages/host.
  • Ran mise exec -- pnpm build in packages/host.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Preview deployments

Host Test Results

    1 files      1 suites   5h 13m 51s ⏱️
2 562 tests 2 540 ✅ 15 💤  0 ❌  7 🔥
7 743 runs  7 670 ✅ 45 💤 14 ❌ 14 🔥

Results for commit dffbbca.

Realm Server Test Results

    1 files      1 suites   18m 18s ⏱️
1 218 tests 1 218 ✅ 0 💤 0 ❌
1 290 runs  1 290 ✅ 0 💤 0 ❌

Results for commit dffbbca.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a Vite dev-server middleware in packages/host to patch optimized dependency sourcemaps on the fly so Vite stops emitting repeated sourcemap warnings during pnpm start.

Changes:

  • Adds a serve-only Vite plugin that intercepts optimized dependency requests under node_modules/.vite/deps.
  • Reads matching .js.map files and pads missing sourcesContent entries before Vite continues serving the dependency.
  • Wires the new middleware into the host app’s Vite plugin list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +123 to +129
server.middlewares.use(async (req, _res, next) => {
try {
let pathname = decodeURI((req.url ?? '').split('?')[0]);
if (optimizedDepUrlRE.test(pathname)) {
let file = path.resolve(server.config.root, pathname.slice(1));
if (file.startsWith(`${depsDir}${path.sep}`)) {
await padOptimizedDepSourcemap(file);
let changed = false;
for (let i = 0; i < map.sources.length; i++) {
if (sourcesContent[i] == null) {
sourcesContent[i] = '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants