I've started learning Webpack 4 since a month. Most things I wanted to do is working great but this importLoaders option of css-loader is still a mystery for me. Its official documentation is poor and I haven't found any well explained writing about it.
My use case is very close to the one presented in the documentation:
{
test: /\.s?css$/,
use: [
ExtractCssChunks.loader,
{
loader: 'css-loader',
options: {
importLoaders: 2, // 0 => no loaders (default); 1 => postcss-loader; 2 => postcss-loader, sass-loader
import: true, // is true by default, but should I use instead false here???
url: false // let postcss do it
}
},
'postcss-loader',
'sass-loader'
]
}
And my vendors.scss for example with different kind of imports:
@charset 'UTF-8';
// Google fonts
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700|Dosis:200,400,500,600');
//FontAwesome (from node_modules)
@import "~@fortawesome/fontawesome-svg-core/styles";
// Site theme
@import "theme/index";
Basically I want sass-loader to do its usual job and postcss to do some manipulation with image files.
So when and why should I use 0/1/2/n for importLoaders option?
How is it affected to my @imports above?
Could someone explain it to me more detailed like in the docs?
Thanks in advance.