legacy-js-api 警告隐藏

问题: 在vue3,启动项目后,终端中展示如下警告

 Deprecation [legacy-js-api]: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

https://sass-lang.com/documentation/breaking-changes/legacy-js-api/ 中给出解释:

  • Dart Sass originally used an API based on the one used by Node Sass, but replaced it with a new, modern API in Dart Sass 1.45.0. The legacy JS API is now deprecated and will be removed in Dart Sass 2.0.0.
  • Dart Sass最初使用的是基于Node Sass使用的API,但在Dart Sass1.45.0中使用了新的现代API。遗留的JS API现在已被弃用,并将在Dart Sass 2.0.0中删除。

解决办法:在vite.config.js中配置。

//scss官网中的解决办法
css: {
    preprocessorOptions: {
      scss: {
        silenceDeprecations: ['legacy-js-api']
      },
    },
  }

//element-plus中的解决办法
css: {
    preprocessorOptions: {
      scss: { api: "modern-compiler" },
    },
},
  • 时间:2025年3月
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蓝莓味的口香糖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值