I am upgrading my current project to Webpack2, which it was using Webpack1 prior. I have looked into a couple tutorials about upgrading and in
As the Webpack 2 migration tutorial states, the difference between both is, that if when we want an array of loaders, we have to use use
, if it's just one loader, then we have to use loader
:
module: {
rules: [
{
test: /\.jsx$/,
loader: "babel-loader", // Do not use "use" here
options: {
// ...
}
},
{
test: /\.less$/,
loader: "style-loader!css-loader!less-loader"
use: [
"style-loader",
"css-loader",
"less-loader"
]
}
]
}
module.rules is meant for loaders. Specifying a rule as loader is just a shortcut for
use: [{loader}]
For plugins, use the plugins property in your configuration.