Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): add sourcemap comment for ES2015 …
Browse files Browse the repository at this point in the history
…differential loading

Fixes angular#15460
  • Loading branch information
clydin committed Aug 27, 2019
1 parent 4986577 commit 2224f22
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/angular_devkit/build_angular/src/utils/process-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,11 @@ async function mangleOriginal(options: ProcessBundleOptions): Promise<void> {
throw resultOriginal.error;
}

if (options.cachePath && options.cacheKeys && options.cacheKeys[CacheKey.OriginalCode]) {
await cacache.put(
options.cachePath,
options.cacheKeys[CacheKey.OriginalCode],
resultOriginal.code,
);
}

fs.writeFileSync(options.filename, resultOriginal.code);

if (resultOriginal.map) {
if (!options.hiddenSourceMaps) {
resultOriginal.code += `\n//# sourceMappingURL=${path.basename(options.filename)}.map`;
}

if (options.cachePath && options.cacheKeys && options.cacheKeys[CacheKey.OriginalMap]) {
await cacache.put(
options.cachePath,
Expand All @@ -222,4 +216,14 @@ async function mangleOriginal(options: ProcessBundleOptions): Promise<void> {

fs.writeFileSync(options.filename + '.map', resultOriginal.map);
}

if (options.cachePath && options.cacheKeys && options.cacheKeys[CacheKey.OriginalCode]) {
await cacache.put(
options.cachePath,
options.cacheKeys[CacheKey.OriginalCode],
resultOriginal.code,
);
}

fs.writeFileSync(options.filename, resultOriginal.code);
}

0 comments on commit 2224f22

Please sign in to comment.