From 13db0e89ef8bc2c0ecda05553133e793ed470774 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Mon, 21 Mar 2016 21:43:51 -0400 Subject: [PATCH] Nullify source maps if they have no mappings. Fixes #6506. --- tools/isobuild/linker.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/isobuild/linker.js b/tools/isobuild/linker.js index 9acfcf9d9e..8a3ca04d12 100644 --- a/tools/isobuild/linker.js +++ b/tools/isobuild/linker.js @@ -131,7 +131,11 @@ _.extend(Module.prototype, { }); // results has 'code' and 'map' attributes } ); - const sourceMap = results.map.toJSON(); + + let sourceMap = results.map.toJSON(); + if (! sourceMap.mappings) { + sourceMap = null; + } const prelinked = { source: results.code, @@ -199,6 +203,9 @@ _.extend(Module.prototype, { }); result.source = swsm.code; result.sourceMap = swsm.map.toJSON(); + if (! result.sourceMap.mappings) { + result.sourceMap = null; + } } else { // If there were no files in this bundle, we do not need to // generate a source map.