Open snoopdouglas opened 8 years ago
There is really no difference between the two. You could even use the following code, which is - in my opinion - the best approach, and produces the same output as the aforementioned snippets.
module: {
loaders: [
{ test: /\.less$/, loaders: ['style', 'css', 'less'] },
{ test: /\.css$/, loaders: ['style', 'css'] },
{ test: /\.(png|jpg)$/, loaders: ['url?limit=8192'] } // inline base64 URLs for <=8k images, direct URLs for the rest
]
}
Agreed, using an array to specify loaders is far neater.
Makes it easy to find usages I guess. Searching in files in your project for 'file-loader' and 'url-loader' is going to turn up much accurate results than searching for 'file' or 'url'.
I'm new to Webpack and have found this howto an invaluable resource. I have a problem (that might end up just being a question) about the
module.loaders
section of ourwebpack.config.js
though:I'm not sure whether this is specific to the loaders used here, but in Webpack's documentation I'm seeing the
-loader
omitted - so we could instead use this:Is there any difference? Would it be worth adding a note mentioning that they're optional?