sassvite

How to set sassOptions in Vite


With webpack, we can set sassOptions like below:

{
  loader: require.resolve('sass-loader'),
  options: {
    sassOptions: { quietDeps: true },
  },
}

Following the vite document, I'm trying to config as below:

  css: {
    preprocessorOptions: {
      scss: {
        sassOptions: { quietDeps: true },
      },
    },
  },

But it seems not work for me. What I need is to hide third-party sass deps's warning message in terminal.


Solution

  • To hide the warnings, update your vite.config.js like this:

    export default defineConfig({
      css: {
        preprocessorOptions: {
          scss: {
            quietDeps: true
          }
        }
      }
    })