在 vue 文件中的
<style lang="less">
//这里写 css 热加载后样式不对,应该是没有编译,只有刷新后样式才会正确
</style>
配置了 webpack
{
test: /\.less$/,
use: ['style-loader','css-loader','less-loader']
}
在 vue-loader 中配置 options 还是不行?
options: {
loaders: {
less: {
use: ['style-loader', 'css-loader', 'less-loader']
}
}
}
应该怎么配置呢?
1
Eoss 2017-09-06 11:39:59 +08:00
```
options: { loaders: { less: 'style-loader!css-loader!less-loader' } } ``` https://vue-loader.vuejs.org/zh-cn/configurations/pre-processors.html |
2
hevi 2017-09-06 18:11:18 +08:00
https://doc.webpack-china.org/loaders/less-loader
//修改 webpack 配置文件 // webpack.config.js module.exports = { ... module: { rules: [{ test: /\.less$/, use: [{ loader: "style-loader" // creates style nodes from JS strings }, { loader: "css-loader" // translates CSS into CommonJS }, { loader: "less-loader" // compiles Less to CSS }] }] } }; |