Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable parallel on WSL due bugs #90

Merged
merged 1 commit into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"dependencies": {
"cacache": "^11.3.2",
"find-cache-dir": "^2.0.0",
"is-wsl": "^1.1.0",
"schema-utils": "^1.0.0",
"serialize-javascript": "^1.7.0",
"source-map": "^0.6.1",
Expand Down
12 changes: 8 additions & 4 deletions src/TaskRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import cacache from 'cacache';
import findCacheDir from 'find-cache-dir';
import workerFarm from 'worker-farm';
import serialize from 'serialize-javascript';
import isWsl from 'is-wsl';

import minify from './minify';

Expand All @@ -19,10 +20,13 @@ export default class TaskRunner {
// In some cases cpus() returns undefined
// https://github.com/nodejs/node/issues/19022
const cpus = os.cpus() || { length: 1 };
this.maxConcurrentWorkers =
parallel === true
? cpus.length - 1
: Math.min(Number(parallel) || 0, cpus.length - 1);
// WSL sometimes freezes, error seems to be on the WSL side
// https://github.com/webpack-contrib/terser-webpack-plugin/issues/21
this.maxConcurrentWorkers = isWsl
? 1
: parallel === true
? cpus.length - 1
: Math.min(Number(parallel) || 0, cpus.length - 1);
}

run(tasks, callback) {
Expand Down