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,重复加载会有问题
    处理步骤:  
      最终代码为删除就可以了
  • 相关阅读:
    Python(93)_网络编程基础
    Web前端(13)_路径
    Web前端(12)_注释
    Web前端(11)_base标签
    Python(91)_python复习
    Web前端(10)_css文本样式
    Web前端(9)_div+span等标签
    虚拟化(6)_CPU虚拟化
    虚拟化(5)_打开tcp监听
    虚拟化(4)_离线克隆与在线克隆
  • 原文地址:https://www.cnblogs.com/dekevin/p/12332746.html
Copyright © 2011-2022 走看看