首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >项目报错Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

项目报错Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

作者头像
fruge365
发布2025-12-15 12:05:44
发布2025-12-15 12:05:44
1350
举报

参考文章:

1.Vite 警报:The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

2.处理报错 Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

前言

最近在写vite + vue3 项目的时候 终端出现 警告,如下图:

在这里插入图片描述
在这里插入图片描述

Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

经过查找发现原因是:使用低sass版本低于2.0.0的,会有上面这个警告

解决方法

在vite.config.[js/ts]. 文件中

代码语言:javascript
复制
export default defineConfig({
  css: {
    preprocessorOptions: {
      // 如果'modern-compiler'不管用,可换成"modern"
      scss: {
        api: 'modern-compiler' // or "modern"
      }
    }
  }
})

非常好用~

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2025-03-20,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 前言
  • 解决方法
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档