如何将./src/style.less
编译为./dist/style.css
?
这是我的webpack.conf.js
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
module: {
rules: [
{
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { url: false, sourceMap: true } },
{ loader: 'less-loader', options: { sourceMap: true } }
],
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "style.css"
})
]
};
此刻,只有当我得到编译的style.css时,
require('./src/style.less' );
进入index.js
实际上,我只发布了与较少编译相关的设置。