Skip to content

Commit

Permalink
fix(@ngtools/webpack): use 8gb memory max for type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva committed Oct 18, 2017
1 parent f2bebfe commit 77a6cc8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/@ngtools/webpack/src/angular_compiler_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,26 @@ export class AngularCompilerPlugin implements Tapable {
: './type_checker.js';


let hasMemoryFlag = false;
const memoryFlagRegex = /--max-old-space-size/;
const debugArgRegex = /--inspect(?:-brk|-port)?|--debug(?:-brk|-port)/;

const execArgv = process.execArgv.filter((arg) => {
// Check if memory is being set by parent process.
if (memoryFlagRegex.test(arg)) {
hasMemoryFlag = true;
}

// Remove debug args.
// Workaround for https://github.com/nodejs/node/issues/9435
const debugArgRegex = /--inspect(?:-brk|-port)?|--debug(?:-brk|-port)/;
return !debugArgRegex.test(arg);
});

if (!hasMemoryFlag) {
// Force max 8gb ram.
execArgv.push('--max-old-space-size=8192');
}

const forkOptions: ForkOptions = { execArgv };

this._typeCheckerProcess = fork(path.resolve(__dirname, typeCheckerFile), [], forkOptions);
Expand Down

0 comments on commit 77a6cc8

Please sign in to comment.