skip to Main Content

I was using create-react-app before and now I switched the same project to vite and everything working fine except I am getting a warning log as follows

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

I want to get rid of these warnings from log while development and build the application. Following are my dependencies

"dependencies": { "@heroicons/react": "^2.1.5", "@tanstack/react-table": "^8.17.3", "i18next": "^23.12.1", "i18next-browser-languagedetector": "^8.0.0", "react": "^18.3.1", "react-dom": "^18.3.1", "react-i18next": "^14.1.3", "react-indiana-drag-scroll": "^2.2.0", "react-toastify": "^10.0.5", "recharts": "^2.13.0-alpha.4", "recoil": "^0.7.7", "sass": "^1.79.1", "uuid": "^10.0.0" }

Node version is v22.7.0

2

Answers


  1. Chosen as BEST ANSWER

    Added following lines in the vite config fixes the issue, I missed it on the sass documentation (changelog). This will hide the warning message from console. Thanks @Family for pointing this out. Please find sass changelog

    //vite.config.ts
    export default defineConfig({
      //..other config
      css: {
        preprocessorOptions: {
          scss: {
            silenceDeprecations: ["legacy-js-api"],
          },
        },
      },
    })
    

  2. The Deprecation might be in the css of heroicons or i18next or toastify, theres nothing you can do about it, when other dependencies update the warning will resolve it self

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search