From 64bb7d7f6d2756908f779a441c176e7faa6f8f40 Mon Sep 17 00:00:00 2001 From: Simon Fox Date: Mon, 26 Jun 2017 11:09:59 +1200 Subject: [PATCH] fix(source-maps): remove existing sourcemap links Some external libraries ship with sourcemaps with the dist package including a `sourcemapUrl` link. This link causes problems during bundling, and is specifically exposed by anonymous amd modules and SystemJS loader (RequireJS). This change modifies amodro to strip any existing `sourcemapURL` link from the source of a referenced library that is being bundled. closes aurelia/cli#659, related to aurelia/cli#624 --- lib/build/amodro-trace/write/packages.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/build/amodro-trace/write/packages.js b/lib/build/amodro-trace/write/packages.js index 43e828107..3599ff38b 100644 --- a/lib/build/amodro-trace/write/packages.js +++ b/lib/build/amodro-trace/write/packages.js @@ -1,7 +1,8 @@ 'use strict'; var defines = require('./defines'), lang = require('../lib/lang'), - parse = require('../lib/parse'); + parse = require('../lib/parse'), + removeMapFileComments = require('../../convert-source-map').removeMapFileComments; /** * For modules that are inside a package config, this transform will write out @@ -27,6 +28,7 @@ function packages(options) { contents = defines.toTransport(context, moduleName, filePath, contents, options); + contents = removeMapFileComments(contents); if (packageName && !hasPackageName) { contents += ';define(\'' + packageName + '\', [\'' + moduleName + @@ -35,7 +37,6 @@ function packages(options) { return contents; }; - } /**