sass 1.8.0后 将不再支持 @import 需要使用 `@use’
官方文档
1、Sass @import rules are deprecated and will be removed in Dart Sass
3.0.0
- 修改方法:
@use "@/variables.scss";
2、Deprecation Warning: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.;
Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
sass 1.80 不再支持全局内置函数、老的 js api 接口
- 修改方法 vue.config.js:
export default defineConfig({
...
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler', // 修改api调用方式
},
},
},
...
});
3. Internal server error: [sass] Undefined variable.
sass 1.80 全局变量和 mixin 需要手动导出
- 修改方法 vue.config.js:
export default defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "@/assets/global.scss" as *;`,
},
},
},
});
解决~~~~~~~~~~~~~~~~~~~~~~~~~~~~~