@@ -11,7 +11,6 @@ const build_optimizer_1 = require("@angular-devkit/build-optimizer");
1111const core_1 = require ( "@angular-devkit/core" ) ;
1212const CopyWebpackPlugin = require ( "copy-webpack-plugin" ) ;
1313const fs_1 = require ( "fs" ) ;
14- const os_1 = require ( "os" ) ;
1514const path = require ( "path" ) ;
1615const typescript_1 = require ( "typescript" ) ;
1716const webpack_1 = require ( "webpack" ) ;
@@ -331,14 +330,9 @@ function getCommonConfig(wco) {
331330 // Name mangling is handled within the browser builder
332331 mangle : environment_options_1 . allowMangle && buildOptions . platform !== 'server' && ! differentialLoadingMode ,
333332 } ;
334- // Use up to 7 CPUs for Terser workers, but no more.
335- // Some environments, like CircleCI, report a large number of CPUs but trying to use them
336- // Will cause `Error: Call retries were exceeded` errors.
337- // https://github.com/webpack-contrib/terser-webpack-plugin/issues/143
338- const maxCpus = Math . min ( os_1 . cpus ( ) . length , 7 ) ;
339333 extraMinimizers . push ( new TerserPlugin ( {
340334 sourceMap : scriptsSourceMap ,
341- parallel : maxCpus ,
335+ parallel : utils_1 . maxWorkers ,
342336 cache : ! environment_options_1 . cachingDisabled && cache_path_1 . findCachePath ( 'terser-webpack' ) ,
343337 extractComments : false ,
344338 chunkFilter : ( chunk ) => ! globalScriptsByBundleName . some ( s => s . bundleName === chunk . name ) ,
@@ -348,7 +342,7 @@ function getCommonConfig(wco) {
348342 // They are shared between ES2015 & ES5 outputs so must support ES5.
349343 new TerserPlugin ( {
350344 sourceMap : scriptsSourceMap ,
351- parallel : maxCpus ,
345+ parallel : utils_1 . maxWorkers ,
352346 cache : ! environment_options_1 . cachingDisabled && cache_path_1 . findCachePath ( 'terser-webpack' ) ,
353347 extractComments : false ,
354348 chunkFilter : ( chunk ) => globalScriptsByBundleName . some ( s => s . bundleName === chunk . name ) ,
0 commit comments