Commit 5c67fd68 authored by Kevin Decker's avatar Kevin Decker Committed by Tim Neutkens

Do not mutate browser source map object (#2900)

Fixes regression caused by #2478
parent e13bb3f6
...@@ -252,13 +252,14 @@ export default async function createCompiler (dir, { buildId, dev = false, quiet ...@@ -252,13 +252,14 @@ export default async function createCompiler (dir, { buildId, dev = false, quiet
let output = transpiled.code let output = transpiled.code
if (map) { if (map) {
map.sources = map.sources.map((source) => source.replace(/\?entry/, '')) let nodeMap = Object.assign({}, map)
delete map.sourcesContent nodeMap.sources = nodeMap.sources.map((source) => source.replace(/\?entry/, ''))
delete nodeMap.sourcesContent
// Output explicit inline source map that source-map-support can pickup via requireHook mode. // Output explicit inline source map that source-map-support can pickup via requireHook mode.
// Since these are not formal chunks, the devtool infrastructure in webpack does not output // Since these are not formal chunks, the devtool infrastructure in webpack does not output
// a source map for these files. // a source map for these files.
const sourceMapUrl = new Buffer(JSON.stringify(map), 'utf-8').toString('base64') const sourceMapUrl = new Buffer(JSON.stringify(nodeMap), 'utf-8').toString('base64')
output = `${output}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${sourceMapUrl}` output = `${output}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${sourceMapUrl}`
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment