Skip to content

Commit 47ba43e

Browse files
committed
fix(example): fix for broken sass and add watch
1 parent 29ced70 commit 47ba43e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

example/webpack.config.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@ const threadLoader = require('thread-loader'); // eslint-disable-line import/no-
55
module.exports = (env) => {
66
const workerPool = {
77
workers: +env.threads,
8+
poolTimeout: env.watch ? Infinity : 2000,
89
};
9-
threadLoader.warmup(workerPool, ['babel-loader', 'babel-preset-env', 'sass-loader', 'css-loader']);
10+
const workerPoolSass = {
11+
workers: +env.threads,
12+
workerParallelJobs: 2,
13+
poolTimeout: env.watch ? Infinity : 2000,
14+
};
15+
if (+env.threads > 0) {
16+
threadLoader.warmup(workerPool, ['babel-loader', 'babel-preset-env']);
17+
threadLoader.warmup(workerPoolSass, ['sass-loader', 'css-loader']);
18+
}
1019
return {
1120
context: __dirname,
1221
entry: ['react', 'lodash-es', './index.js'],
@@ -32,7 +41,7 @@ module.exports = (env) => {
3241
use: [
3342
env.threads !== 0 && {
3443
loader: 'thread-loader',
35-
options: workerPool,
44+
options: workerPoolSass,
3645
},
3746
'css-loader',
3847
'sass-loader',

0 commit comments

Comments
 (0)