Skip to content

Commit

Permalink
fix: duplicated sourceMappingURL for worker bundles (fix #11601) (#11602
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Karshilov committed Jan 26, 2023
1 parent ffbdcdb commit 5444781
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions packages/vite/src/node/plugins/worker.ts
Expand Up @@ -142,13 +142,7 @@ function emitSourcemapForWorkerEntry(
const { map: sourcemap } = chunk

if (sourcemap) {
if (config.build.sourcemap === 'inline') {
// Manually add the sourcemap to the code if configured for inline sourcemaps.
// TODO: Remove when https://github.com/rollup/rollup/issues/3913 is resolved
// Currently seems that it won't be resolved until Rollup 3
const dataUrl = sourcemap.toUrl()
chunk.code += `//# sourceMappingURL=${dataUrl}`
} else if (
if (
config.build.sourcemap === 'hidden' ||
config.build.sourcemap === true
) {
Expand All @@ -159,20 +153,6 @@ function emitSourcemapForWorkerEntry(
type: 'asset',
source: data,
})

// Emit the comment that tells the JS debugger where it can find the
// sourcemap file.
// 'hidden' causes the sourcemap file to be created but
// the comment in the file to be omitted.
if (config.build.sourcemap === true) {
// inline web workers need to use the full sourcemap path
// non-inline web workers can use a relative path
const sourceMapUrl =
query?.inline != null
? mapFileName
: path.relative(config.build.assetsDir, mapFileName)
chunk.code += `//# sourceMappingURL=${sourceMapUrl}`
}
}
}

Expand Down

0 comments on commit 5444781

Please sign in to comment.