Skip to content

Commit 5444781

Browse files
authoredJan 26, 2023
fix: duplicated sourceMappingURL for worker bundles (fix #11601) (#11602)
1 parent ffbdcdb commit 5444781

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed
 

‎packages/vite/src/node/plugins/worker.ts

+1-21
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,7 @@ function emitSourcemapForWorkerEntry(
142142
const { map: sourcemap } = chunk
143143

144144
if (sourcemap) {
145-
if (config.build.sourcemap === 'inline') {
146-
// Manually add the sourcemap to the code if configured for inline sourcemaps.
147-
// TODO: Remove when https://github.com/rollup/rollup/issues/3913 is resolved
148-
// Currently seems that it won't be resolved until Rollup 3
149-
const dataUrl = sourcemap.toUrl()
150-
chunk.code += `//# sourceMappingURL=${dataUrl}`
151-
} else if (
145+
if (
152146
config.build.sourcemap === 'hidden' ||
153147
config.build.sourcemap === true
154148
) {
@@ -159,20 +153,6 @@ function emitSourcemapForWorkerEntry(
159153
type: 'asset',
160154
source: data,
161155
})
162-
163-
// Emit the comment that tells the JS debugger where it can find the
164-
// sourcemap file.
165-
// 'hidden' causes the sourcemap file to be created but
166-
// the comment in the file to be omitted.
167-
if (config.build.sourcemap === true) {
168-
// inline web workers need to use the full sourcemap path
169-
// non-inline web workers can use a relative path
170-
const sourceMapUrl =
171-
query?.inline != null
172-
? mapFileName
173-
: path.relative(config.build.assetsDir, mapFileName)
174-
chunk.code += `//# sourceMappingURL=${sourceMapUrl}`
175-
}
176156
}
177157
}
178158

0 commit comments

Comments
 (0)
Please sign in to comment.