我尝试使用命令gulp编译我的项目但是我收到了这个错误。
Module parse failed: /node_modules/element-ui/lib/theme-default/index.css Unexpected character '@' (1:0)
message: './~/element-ui/lib/theme-default/index.css\nModule parse failed: /Users/leococo/Site/mtlgigsGood/node_modules/element-ui/lib/theme-default/index.css Unexpected character \'@\' (1:0)\nYou may need an appropriate loader to handle
导致问题的文件以:
开头@charset "UTF-8";
如果我采用webpack v1语法而不是webpack v2
,这是有效的 Elixir.webpack.mergeConfig({
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
// other options...
module: {
// module.rules is the same as module.loaders in 1.x
rules: [
{
test: /\.css$/,
loader: 'style!css'
},
],
},
});
Elixir.webpack.mergeConfig({
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
module: {
loaders: [
{
test: /\.css$/,
loader: 'style!css'
}]
},
});
答案 0 :(得分:0)
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},