webpack3.8.1中配置
{
test: /\.less$/,
exclude: [path.join(__dirname, '../src/containers/'),path.join(__dirname, '../src/components/')],
use: [
"style-loader",
"css-loader",
"less-loader"
]
},
{
test: /\.less$/,
include: [path.join(__dirname, '../src/containers/'),path.join(__dirname, '../src/components/')],
use: [
"style-loader",
"css-loader?modules&importLoaders=1&localIdentName=[path][name]---[local]---[hash:base64:5]",
"less-loader"
]
}
在containers和components文件夹中开启css模块化