Skip to content

Commit 0da2f10

Browse files
chore(NA): removes use of parallel option in the terser minimizer (#57077) (#57145)
* chore(NA): removes use of parallel option in the terser minimizer * docs(NA): update note Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 6967e1e commit 0da2f10

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/optimize/base_optimizer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ export default class BaseOptimizer {
439439
optimization: {
440440
minimizer: [
441441
new TerserPlugin({
442-
parallel: this.getThreadLoaderPoolConfig().workers,
442+
parallel: false,
443443
sourceMap: false,
444444
cache: false,
445445
extractComments: false,

src/optimize/dynamic_dll_plugin/dll_config_model.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,20 @@ function common(config) {
214214
return webpackMerge(generateDLL(config));
215215
}
216216

217-
function optimized(config) {
217+
function optimized() {
218218
return webpackMerge({
219219
mode: 'production',
220220
optimization: {
221221
minimizer: [
222222
new TerserPlugin({
223-
// Apply the same logic used to calculate the
224-
// threadLoaderPool workers number to spawn
225-
// the parallel processes on terser
226-
parallel: config.threadLoaderPoolConfig.workers,
223+
// NOTE: we should not enable that option for now
224+
// Since 2.0.0 terser-webpack-plugin is using jest-worker
225+
// to run tasks in a pool of workers. Currently it looks like
226+
// is requiring too much memory and break on large entry points
227+
// compilations (like this) one. Also the gain we have enabling
228+
// that option was barely noticed.
229+
// https://github.com/webpack-contrib/terser-webpack-plugin/issues/143
230+
parallel: false,
227231
sourceMap: false,
228232
cache: false,
229233
extractComments: false,
@@ -250,5 +254,5 @@ export function configModel(rawConfig = {}) {
250254
return webpackMerge(common(config), unoptimized());
251255
}
252256

253-
return webpackMerge(common(config), optimized(config));
257+
return webpackMerge(common(config), optimized());
254258
}

0 commit comments

Comments
 (0)