From 58dc0ee3bb6ad1cd5b161cb85facfa34a5696519 Mon Sep 17 00:00:00 2001 From: Slava Kim Date: Thu, 20 Feb 2014 19:32:16 -0800 Subject: [PATCH 1/2] Print a warning if the generated source map failed to be applied --- tools/bundler.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/bundler.js b/tools/bundler.js index a9beb901dd..c9ae8dca03 100644 --- a/tools/bundler.js +++ b/tools/bundler.js @@ -840,8 +840,13 @@ _.extend(ClientTarget.prototype, { _.each(originals, function (file, name) { if (! file.sourceMap) return; - newMap.applySourceMap( - new sourcemap.SourceMapConsumer(file.sourceMap), name); + try { + newMap.applySourceMap( + new sourcemap.SourceMapConsumer(file.sourceMap), name); + } catch (err) { + console.log("warn: failed to apply the source map for " + + name.slice(0, name.length - 4)); + } }); self.css[0].setSourceMap(JSON.stringify(newMap)); From 0eaa021f4cd9d0b92c1c359f1f93dd8e741d0c7f Mon Sep 17 00:00:00 2001 From: Emily Stark Date: Fri, 21 Feb 2014 09:05:51 -0800 Subject: [PATCH 2/2] Just drop sourcemaps that fail to be applied. --- tools/bundler.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/bundler.js b/tools/bundler.js index c9ae8dca03..0468cfb6d2 100644 --- a/tools/bundler.js +++ b/tools/bundler.js @@ -844,8 +844,11 @@ _.extend(ClientTarget.prototype, { newMap.applySourceMap( new sourcemap.SourceMapConsumer(file.sourceMap), name); } catch (err) { - console.log("warn: failed to apply the source map for " + - name.slice(0, name.length - 4)); + // If we can't apply the source map, silently drop it. + // + // XXX This is here because there are some less files that + // produce source maps that throw when consumed. We should + // figure out exactly why and fix it, but this will do for now. } });