diff --git a/packages/webpack/src/ember-webpack.ts b/packages/webpack/src/ember-webpack.ts index 17eaaf8c7..27a9e27cc 100644 --- a/packages/webpack/src/ember-webpack.ts +++ b/packages/webpack/src/ember-webpack.ts @@ -557,12 +557,21 @@ const threadLoaderOptions = { poolTimeout: Infinity, }; +function canUseThreadLoader(extraOptions: object | false | undefined) { + // If the environment sets JOBS to 0, or if our extraOptions are set to false, + // we have been explicitly configured not to use thread-loader + if (process.env.JOBS === '0' || extraOptions === false) { + return false; + } else { + return true; + } +} + function warmUp(extraOptions: object | false | undefined) { - // We don't know if we'll be parallel-safe or not, but if the environment sets - // JOBS to 0, or our extraOptions are set to false, we know we won't use - // thread-loader, so no need to consume extra resources warming the worker - // pool - if (process.env.JOBS === '1' || extraOptions === false) { + // We don't know if we'll be parallel-safe or not, but if we've been + // configured to not use thread-loader, then there is no need to consume extra + // resources warming the worker pool + if (!canUseThreadLoader(extraOptions)) { return null; } @@ -573,7 +582,7 @@ function warmUp(extraOptions: object | false | undefined) { } function maybeThreadLoader(isParallelSafe: boolean, extraOptions: object | false | undefined) { - if (process.env.JOBS === '0' || extraOptions === false || !isParallelSafe) { + if (!canUseThreadLoader(extraOptions) || !isParallelSafe) { return null; } diff --git a/packages/webpack/src/options.ts b/packages/webpack/src/options.ts index 28210e4c0..d6bf09c25 100644 --- a/packages/webpack/src/options.ts +++ b/packages/webpack/src/options.ts @@ -25,7 +25,7 @@ export interface Options { // will be used to configure `thread-loader`. If not specified, // `thread-loader` will be used with a default configuration. // - // Note that setting `JOBS=1` in the environment will also disable + // Note that setting `JOBS=0` in the environment will also disable // `thread-loader`. threadLoaderOptions?: object | false;