Child extract-text-webpack-plugin node_modules/_extract-text-webpack-plugin@3.0.2@extract-text-web pack-plugin/dist node_modules/_style-loader@0.21.0@style-loader/index.js!src/page/index/index.css:
[0] ./node_modules/_style-loader@0.21.0@style-loader!./src/page/index/index.css 991 bytes { 0} [built]
[1] ./src/page/index/index.css 214 bytes {0} [built] [failed] [1 error]
+ 2 hidden modules
ERROR in ./src/page/index/index.css
Module parse failed: D:\server\mmall-fe\src\page\index\index.css Unexpected token (1:4)
You may need an appropriate loader to handle this file type.
| body{
| background: #ccc;
| }
@ ./node_modules/_style-loader@0.21.0@style-loader!./src/page/index/index.css 2:14-38
报错是3.0有某些原因导致版本不匹配
重新安装插件
cnpm install --save-dev extract-text-webpack-plugin@2.1.2
在webpack.config.js中需要配置文件
var Ex = require('extract-text-webpack-plugin');/*css分离打包设置*/
var Ex = require('extract-text-webpack-plugin');/*css分离打包设置*/
module: {
loaders:[
{
test: /\.css$/,
loader: Ex.extract({
fallback:'style-loader',
use: "css-loader"
})
}
]
},
问题已完美解决