dcloudio / uni-app

A cross-platform framework using Vue.js
https://uniapp.dcloud.io
Apache License 2.0
40.03k stars 3.63k forks source link

除H5端以外,sass的api配置无效 #5152

Open xiaohe0601 opened 1 month ago

xiaohe0601 commented 1 month ago

sass1.79.1 开始会提示 2.0.0 后会移除 legacy API

Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

通过配置 Vite 的 css.preprocessorOptions 可以修改使用的 sass API

// vite.config.ts

export default defineConfig({
  // ...
  css: {
    preprocessorOptions: {
      scss: {
        api: 'modern'
      }
    }
  }
});

配置后H5端不再出现warning,但是其他端依然会有提示

版本信息

Subilan commented 1 month ago

但是怎么才能知道有哪些代码用到了 legacy API 呢。。。这排查起来也不容易呀。

Ttou commented 1 month ago

确实有这个问题

Ttou commented 1 month ago

https://github.com/vitejs/vite/issues/18164