@@ -16,13 +16,14 @@ import fs from 'fs';
1616import HtmlPlugin from 'html-webpack-plugin' ;
1717import ImageMinimizerPlugin from 'image-minimizer-webpack-plugin' ;
1818import MiniCssExtractPlugin from 'mini-css-extract-plugin' ;
19+ import { createRequire } from 'module' ;
20+ import { availableParallelism } from 'os' ;
1921import path from 'path' ;
2022import { validate } from 'schema-utils' ;
2123import TerserPlugin from 'terser-webpack-plugin' ;
24+ import { fileURLToPath } from 'url' ;
2225import webpack from 'webpack' ;
2326import WebpackRequireFromPlugin from 'webpack-require-from' ;
24- import { fileURLToPath } from 'url' ;
25- import { createRequire } from 'module' ;
2627
2728const __filename = fileURLToPath ( import . meta. url ) ;
2829const __dirname = path . dirname ( __filename ) ;
@@ -31,6 +32,12 @@ const { DefinePlugin, optimize, WebpackError } = webpack;
3132
3233const require = createRequire ( import . meta. url ) ;
3334
35+ const cores = Math . max ( Math . floor ( availableParallelism ( ) / 6 ) - 1 , 1 ) ;
36+ const eslintWorker = {
37+ max : cores ,
38+ filesPerWorker : 100 ,
39+ } ;
40+
3441/**
3542 * @param {{ analyzeBundle?: boolean; analyzeDeps?: boolean; esbuild?: boolean; skipLint?: boolean } | undefined } env
3643 * @param {{ mode: 'production' | 'development' | 'none' | undefined } } argv
@@ -84,7 +91,7 @@ function getExtensionConfig(target, mode, env) {
8491 plugins . push (
8592 new ESLintLitePlugin ( {
8693 files : path . join ( __dirname , 'src' , '**' , '*.ts' ) ,
87- worker : true ,
94+ worker : eslintWorker ,
8895 eslintOptions : {
8996 cache : true ,
9097 cacheLocation : path . join ( __dirname , '.eslintcache/' , target === 'webworker' ? 'browser/' : '' ) ,
@@ -352,7 +359,7 @@ function getWebviewsConfig(mode, env) {
352359 plugins . push (
353360 new ESLintLitePlugin ( {
354361 files : path . join ( basePath , '**' , '*.ts?(x)' ) ,
355- worker : true ,
362+ worker : eslintWorker ,
356363 eslintOptions : {
357364 cache : true ,
358365 cacheLocation : path . join ( __dirname , '.eslintcache' , 'webviews/' ) ,
0 commit comments