Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.

今天写项目的时候碰到一个报错,在网上查找到了解决方法,这里备份一下。防止下次再次遇到

原文章链接:Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.

报错内容如下:

Deprecation Warning: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0. More info and automated migrator: https://sass-lang.com/d/import 1 @import "./src/styles/global.scss";

这是因为 @import 规则已被弃用,并将在Dart Sass 3.0.0中删除。

解决方法:

1.修改全局样式引入,将引用 @import 改成 @use,代码如下:

复制代码
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@use "./src/styles/global.scss" as *;`
      }
    }
  },

2.修改全局变量

$--color-primary: #409EFF; 修改为 $colorPrimary: #409EFF;,并且修改替换使用的变量名

这样问题就解决了

相关推荐
晓晨的博客7 分钟前
ROS1录制的bag包转换为ROS2格式
前端·chrome
Wect15 分钟前
LeetCode 72. 编辑距离:动态规划经典题解
前端·算法·typescript
donecoding28 分钟前
别再让 pnpm 跟着 nvm 跑了!独立安装终极指南
前端·node.js·前端工程化
GISer_Jing30 分钟前
AI全栈转型_TS后端学习路线
前端·人工智能·后端·学习
竹林81830 分钟前
被The Graph的GraphQL查询坑了三天,我用一个真实DeFi项目把链上数据索引彻底搞懂了
前端·graphql
漫游的渔夫30 分钟前
前端开发者做 Agent:别只会执行,用 4 类失败策略让 AI 知道怎么停
前端·人工智能·typescript
用户0595401744633 分钟前
把多级缓存一致性验证从手工测试换成 Pytest 参数化,Bug 排查时间缩短 90%
前端·css
暗不需求35 分钟前
深入理解 LangChain:AI 应用开发框架的工程化实践
前端·langchain
用户059540174461 小时前
把 Redis 持久化测试从 800 行 Shell 换成 30 行 pytest,排错效率翻了 10 倍
前端·css
GISer_Jing1 小时前
AI全栈工程师知识体系全景:从前后端核心架构到落地项目全拆解
前端·人工智能·后端·ai编程