Skip to content

Commit 1ab6091

Browse files
clydinvikerman
authored andcommitted
fix(@angular-devkit/build-angular): prevent differential loading double sourcemap search
This can drastically reduce memory usage; especially in cases where bundled code modules contain individual sourcemap comments and vendor sourcemaps are disabled. Enabling the vendor sourcemap option has the side effect of removing all individual module sourcemap comments and as a result removes the potential for those comments to be found and processed.
1 parent 5facdf1 commit 1ab6091

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/angular_devkit/build_angular/src/utils/process-bundle.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,16 @@ export async function process(options: ProcessBundleOptions): Promise<ProcessBun
9797
const manualSourceMaps = codeSize >= 1024 * 1024 || mapSize >= 1024 * 1024;
9898

9999
const sourceCode = options.code;
100-
const sourceMap = options.map ? JSON.parse(options.map) : undefined;
100+
const sourceMap = options.map ? JSON.parse(options.map) : false;
101101

102102
let downlevelCode;
103103
let downlevelMap;
104104
if (downlevel) {
105105
// Downlevel the bundle
106106
const transformResult = await transformAsync(sourceCode, {
107107
filename: options.filename,
108-
inputSourceMap: manualSourceMaps ? undefined : sourceMap,
108+
// using false ensures that babel will NOT search and process sourcemap comments (large memory usage)
109+
inputSourceMap: manualSourceMaps ? false : sourceMap,
109110
babelrc: false,
110111
presets: [
111112
[

0 commit comments

Comments
 (0)