From f288345e1b3182d3cb4922656ad2ebbe957b2fa3 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Sun, 2 Dec 2018 11:57:27 -0800 Subject: [PATCH 1/2] Handle sourcemaps --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 5191f0f..a0274a8 100644 --- a/index.js +++ b/index.js @@ -208,7 +208,8 @@ module.exports = function svelte(options = {}) { } }, fixedOptions, { name: capitalize(sanitize(id)), - filename: id + filename: id, + sourceMap: code.getMap ? code.getMap() : undefined }) ); @@ -244,15 +245,15 @@ module.exports = function svelte(options = {}) { if (chunk.map) { const i = sources.length; - sources.push(chunk.map.sources[0]); - sourcesContent.push(chunk.map.sourcesContent[0]); + sources.push(...chunk.map.sources); + sourcesContent.push(...chunk.map.sourcesContent); const decoded = decode(chunk.map.mappings); if (i > 0) { decoded.forEach(line => { line.forEach(segment => { - segment[1] = i; + segment[1] += i; }); }); } From 465020fc15ba467ebfdbe84367bf3e75d6f0f897 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Mon, 19 Oct 2020 21:30:48 -0700 Subject: [PATCH 2/2] fix: blame the github editor --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1bb8583..2f197a8 100644 --- a/index.js +++ b/index.js @@ -266,7 +266,7 @@ module.exports = function svelte(options = {}) { code, Object.assign(base_options, fixed_options, { filename }, major_version >= 3 ? null : { name: capitalize(sanitize(id)), - sourceMap: code.getMap ? code.getMap() : undefined + sourceMap: code.getMap ? code.getMap() : undefined }) );