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月
更多推荐




所有评论(0)