extract-text-webpack-plugin 3.0报错

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"
                })
            }
        ]
    },

问题已完美解决

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值