码迷,mamicode.com
首页 > Windows程序 > 详细

scss文件报错处理 (报错信息Invalid CSS after "v": expected 1 selector or at-rule, was 'var api = require)

时间:2020-02-19 20:39:36      阅读:430      评论:0      收藏:0      [点我收藏+]

标签:lin   fail   问题   ima   modules   style   重复   jin   res   

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,重复加载会有问题
处理步骤:  
  最终代码为删除就可以了
技术图片

 

 

scss文件报错处理 (报错信息Invalid CSS after "v": expected 1 selector or at-rule, was 'var api = require)

标签:lin   fail   问题   ima   modules   style   重复   jin   res   

原文地址:https://www.cnblogs.com/dekevin/p/12332746.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!