zoukankan      html  css  js  c++  java
  • scss文件报错处理 (报错信息Invalid CSS after "v": expected 1 selector or at-rule, was 'var api = require)

    error  in ./src/assets/styles/app.scss
     
    Module build failed:
    @import "./reset.scss";
    ^
          Invalid CSS after "v": expected 1 selector or at-rule, was 'var api = require("'
          in /Users/aa/demo/new/src/assets/styles/app.scss (line 1, column 1)
     
     
    @ ./src/modules/a/index.js 9:0-34
    @ multi (webpack)-dev-server/client?http://localhost:8086 webpack/hot/dev-server ./src/modules/a/index.js

    处理步骤:

      将webpack.base.config.js scss配置
    原代码为:
    {
        test: /.scss$/,
        loader: 'sass-loader!style-loader!css-loader',
    }

    改为

    {
        test: /.scss$/,
        use:[
            'style-loader',
            'css-loader',
            {
                loader: 'sass-loader',
                options: {
                    indentedSyntax: true
                }
            }
        ]
    }

     2.重新执行项目继续报错

    Module build failed:
    @import "./reset.scss";
    ^
          Invalid CSS after "...load the styles": expected 1 selector or at-rule, was "var content = requi"
          in /Users/zhangrui/jinmao/new/src/assets/styles/app.scss (line 1, column 1)
     
     
    @ ./src/assets/styles/app.scss 2:26-435
    @ ./src/modules/a/index.js
    @ multi (webpack)-dev-server/client?http://localhost:8086 webpack/hot/dev-server ./src/modules/a/index.js

    报错原因:

      因为utils.js已经加载了scss,重复加载会有问题
    处理步骤:  
      最终代码为删除就可以了
  • 相关阅读:
    myfocus之焦点图
    win7磁盘分区工具
    java线程两种创建方式的区别与模拟买票情景
    jsp指令与动作
    Cookie记住登陆账号和密码
    jsp+javabean实现简单的用户登陆
    jsp简单登陆实现
    strut2 文件上传完整案例
    poi 导出excel文件
    poi excel文件的导入
  • 原文地址:https://www.cnblogs.com/dekevin/p/12332746.html
Copyright © 2011-2022 走看看