Closed knaos closed 6 years ago
https://github.com/amireh/happypack#using-multiple-instances
loaders
is an array of loader objects so you should be able to just copy what you had before inside the use
Example:
new HappyPack({
id: "styles",
threads: 2,
loaders:[{
loader: "css-loader",
...
}, {
loader: "postcss-loader",
}, {
loader: "sass-loader",
options: {
...
}
}]
})
What @pedroabreu said. The supported notations for configuring loaders is now specified in the README.
One side question would be, how can I prevent build emmiting on error?
Did you try the NoEmitOnErrors plugin?
Closing since it doesn't appear to be an issue, the docs cover this information (if it's not clear enough, PRs are welcome :)
Currently I found it very hard to implement it into Webpack 3, majorly because of the change how loaders are configured there (Webpack 3 uses loaders).
This is how I configured it to work with ts-loader:
{ test: /\.ts$/, exclude: /node_modules/, use: { loader: require.resolve('happypack/loader'), options: { id: 'ts' } } },
And when I wanted it to work with my styles, I did not know how to configure it to use several loaders. I ended up with this:
{ test: /\.scss$/, use: [ 'file-loader?name=styles/[name].css', 'extract-loader', { loader: require.resolve('happypack/loader'), options: { id: "css" } }, { loader: 'postcss-loader', options: { plugins: function () { return [ require('autoprefixer') ]; } } }, { loader: 'sass-loader', options: { sourceComments: true, includePaths: [require('bourbon').includePaths] } } ] },
Which worked only for the css-loader.
Am I doing something wrong? Or am I missing something?
Anyway happy pack made everything quite fast :) Good job guys!
One side question would be, how can I prevent build emmiting on error?