Skip to content

Instantly share code, notes, and snippets.

@ShinyChang
Created February 19, 2019 15:32
Show Gist options
  • Save ShinyChang/204586f7a57152f9b6cae79f6a66bdc1 to your computer and use it in GitHub Desktop.
Save ShinyChang/204586f7a57152f9b6cae79f6a66bdc1 to your computer and use it in GitHub Desktop.
...
const threadLoader = require('thread-loader');
const jsWorkerPool = {
poolTimeout: 2000
};
const cssWorkerPool = {
workerParallelJobs: 2,
poolTimeout: 2000
};
threadLoader.warmup(jsWorkerPool, ['babel-loader']);
threadLoader.warmup(cssWorkerPool, ['css-loader', 'postcss-loader']);
module.exports = {
...
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'thread-loader',
options: jsWorkerPool
},
'babel-loader'
]
},
{
test: /\.s?css$/,
exclude: /node_modules/,
use: [
'style-loader',
{
loader: 'thread-loader',
options: cssWorkerPool
},
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]__[local]--[hash:base64:5]',
importLoaders: 1
}
},
'postcss-loader'
]
}
...
]
...
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment