From 260be86da8a6ea02c36c2ab10ead6282aa0d4d98 Mon Sep 17 00:00:00 2001 From: Kevin Decker Date: Sun, 3 Sep 2017 16:25:48 -0500 Subject: [PATCH] Do not mutate browser source map object Fixes regression caused by #2478 --- server/build/webpack.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/build/webpack.js b/server/build/webpack.js index eb74375876bb0..3422cbf771d02 100644 --- a/server/build/webpack.js +++ b/server/build/webpack.js @@ -252,13 +252,14 @@ export default async function createCompiler (dir, { buildId, dev = false, quiet let output = transpiled.code if (map) { - map.sources = map.sources.map((source) => source.replace(/\?entry/, '')) - delete map.sourcesContent + let nodeMap = Object.assign({}, map) + 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. // Since these are not formal chunks, the devtool infrastructure in webpack does not output // 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}` }