Skip to content

Commit 5c67fd6

Browse files
kpdeckertimneutkens
authored andcommitted
Do not mutate browser source map object (vercel#2900)
Fixes regression caused by vercel#2478
1 parent e13bb3f commit 5c67fd6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

server/build/webpack.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,14 @@ export default async function createCompiler (dir, { buildId, dev = false, quiet
252252
let output = transpiled.code
253253

254254
if (map) {
255-
map.sources = map.sources.map((source) => source.replace(/\?entry/, ''))
256-
delete map.sourcesContent
255+
let nodeMap = Object.assign({}, map)
256+
nodeMap.sources = nodeMap.sources.map((source) => source.replace(/\?entry/, ''))
257+
delete nodeMap.sourcesContent
257258

258259
// Output explicit inline source map that source-map-support can pickup via requireHook mode.
259260
// Since these are not formal chunks, the devtool infrastructure in webpack does not output
260261
// a source map for these files.
261-
const sourceMapUrl = new Buffer(JSON.stringify(map), 'utf-8').toString('base64')
262+
const sourceMapUrl = new Buffer(JSON.stringify(nodeMap), 'utf-8').toString('base64')
262263
output = `${output}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${sourceMapUrl}`
263264
}
264265

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy