更新时间:2023-10-25 15:29:10
这是 vue-加载程序(这是vue-webpack模板中的主要插件).
This is the default behaviour for vue-loader (which is the main plugin in the vue-webpack template).
但是,如果需要,您可以将所有CSS提取到一个文件中:
However, if you want to you can extract all CSS into one file:
npm install extract-text-webpack-plugin --save-dev
// webpack.config.js
var ExtractTextPlugin = require("extract-text-webpack-plugin")
module.exports = {
// other options...
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
]
},
vue: {
loaders: {
css: ExtractTextPlugin.extract("css"),
// you can also include <style lang="less"> or other langauges
less: ExtractTextPlugin.extract("css!less")
}
},
plugins: [
new ExtractTextPlugin("style.css")
]
}
查看有关提取的 vue-loader 的文档