Skip to content

Commit

Permalink
fix: sourcemap missing source files warning with cached vue (#7442)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Mar 24, 2022
1 parent 476786b commit a2ce20d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/vite/src/node/utils.ts
Expand Up @@ -615,13 +615,16 @@ export function combineSourcemaps(

// hack for parse broken with normalized absolute paths on windows (C:/path/to/something).
// escape them to linux like paths
sourcemapList.forEach((sourcemap) => {
sourcemap.sources = sourcemap.sources.map((source) =>
// also avoid mutation here to prevent breaking plugin's using cache to generate sourcemaps like vue (see #7442)
sourcemapList = sourcemapList.map((sourcemap) => {
const newSourcemaps = { ...sourcemap }
newSourcemaps.sources = sourcemap.sources.map((source) =>
source ? escapeToLinuxLikePath(source) : null
)
if (sourcemap.sourceRoot) {
sourcemap.sourceRoot = escapeToLinuxLikePath(sourcemap.sourceRoot)
newSourcemaps.sourceRoot = escapeToLinuxLikePath(sourcemap.sourceRoot)
}
return newSourcemaps
})
const escapedFilename = escapeToLinuxLikePath(filename)

Expand Down

0 comments on commit a2ce20d

Please sign in to comment.