Skip to content

Commit

Permalink
fix(bundle): exclude source-maps when applicable
Browse files Browse the repository at this point in the history
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 d94629f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/build/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d94629f

Please sign in to comment.