Permalink
Browse files

fix(bundle): exclude source-maps when applicable

If a vendor bundle contains source maps, currently those source maps
are created/copied over to the dist folder despite source maps being
disabled in the aurelia options. This fix checks to make sure that
source maps should be enabled before making them.
  • Loading branch information...
AStoker committed Aug 30, 2017
1 parent a06a4f3 commit d94629f0465a1966ef211c36c739bc74ce232423
Showing with 10 additions and 7 deletions.
  1. +10 −7 lib/build/bundle.js
View
@@ -151,7 +151,8 @@ exports.Bundle = class {
for (let i = 0; i < files.length; ++i) {
let currentFile = files[i];
let sourceMap = buildOptions.isApplicable('sourcemaps') ? currentFile.sourceMap : undefined;
let sourceMapEnabled = buildOptions.isApplicable('sourcemaps');
let sourceMap = sourceMapEnabled ? currentFile.sourceMap : undefined;
function fileIsDependency(file) {
return file
@@ -198,12 +199,14 @@ exports.Bundle = class {
return sourceMap;
}
if (fileIsDependency(currentFile)) {
sourceMap = acquireSourceMapForDependency(currentFile);
}
if (sourceMap) {
needsSourceMap = true;
if (sourceMapEnabled) {
if (fileIsDependency(currentFile)) {
sourceMap = acquireSourceMapForDependency(currentFile);
}
if (sourceMap) {
needsSourceMap = true;
}
}
concat.add(currentFile.path, currentFile.contents, sourceMap ? JSON.stringify(sourceMap) : undefined);

0 comments on commit d94629f

Please sign in to comment.