修复控制台出现 Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0 的问题

背景

项目使用到Vite5.3.1+Sass,然后突然某天启动项目,控制台出现了这一行报错,百度找了一遍没找到解决方案。
最后去StackOverflow找了一下,解决了。

解决办法

vite.config.js 中添加这一配置即可。

import { defineConfig } from "vite";
export default defineConfig({
// ...
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler" // or 'modern'
}
}
},
// ...
});

原文链接

sass - How to set sassOptions in Vite -Stack Overflow stackoverflow.com

posted @   脆皮鸡  阅读(19727)  评论(2编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏
点击右上角即可分享
微信分享提示