在webpack.config.js进行webpack加载器配置的时候,css加载器必须在js加载器前面,而且style-loader加载器必须在css-loader加载器前面
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {}
// other vue-loader options go here
}
},
// css加载器要在js加载器前面
{
test: /\.css$/,
// style-loader加载器要在css-loader加载器前面
loader: 'style-loader!css-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
loader: 'file-loader'
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},