Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
·
在使用vue和sass时出现的警告,Deprecation The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

意思是旧版的JS API已弃用,并将在 Sass 2.0.0 中删除。
解决方案:
一,解决的第一个方法是降sass的版本。
二,修改 vue.config.js 中的配置。
css: {
loaderOptions: {
scss: {
api: "modern"
}
}
},
用于配置 CSS 预处理器的加载器选项。目的是定制化处理样式文件的方式。
loaderOptions代表允许向允许你向 CSS 相关的加载器传递额外的选项。 Vue CLI 的版本在3以上要使用 loaderOptions ,不能使用 preprocessorOptions ,否则会触发 "css.preprocessorOptions" is not allowed 的错误。
api: "modern" 指定使用SCSS 的“现代”编译方式。

更多推荐


所有评论(0)