Skip to content

Sass Deprecation Warning when building Vue project with Vite #18164

@matvejs16

Description

@matvejs16

Describe the bug

When using Vite with SCSS, a deprecation warning is displayed regarding the legacy JS API for Dart Sass. This warning appears despite Vite's built-in support for CSS pre-processors, including Sass. The warning message is as follows:

Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
More info: https://sass-lang.com/d/legacy-js-api

This issue is related to Vite's handling of Sass compilation, as Vite documentation states that it provides built-in support for .scss and .sass files without the need for additional plugins:

Vite does provide built-in support for .scss, .sass, .less, .styl and .stylus files. There is no need to install Vite-specific plugins for them, but the corresponding pre-processor itself must be installed

The problem occurs in a clean Vite project with SCSS installed, indicating that it's not specific to any particular framework like Vue.

Reproduction

https://stackblitz.com/edit/vitejs-vite-icvcyy?file=index.html

Steps to reproduce

  1. Create a new Vite project (e.g., using npm create vite@latest)
  2. Add SCSS to the project dependencies (npm add -D sass)
  3. Create a .scss file (e.g., src/style.scss) and import it in your main JavaScript file
  4. Add some SCSS content to the file (e.g., $font-stack: Helvetica, sans-serif; body { font: 100% $font-stack; })
  5. Run the dev server (npm run dev) or build the project (npm run build)
  6. Observe the deprecation warning in the console output

These steps can be seen in action in the provided StackBlitz reproduction.

Note: The warning appears during both development and build processes of a Vite project that uses Sass/SCSS.

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 52.68 GB / 62.67 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 10.8.3 - ~/.nvm/versions/node/v20.12.2/bin/npm
npmPackages:
    @vitejs/plugin-vue: ^5.1.4 => 5.1.4 
    vite: ^5.4.7 => 5.4.7

Used Package Manager

npm

Logs

Click to expand!
vite:load 0.36ms [plugin] /src/components/sizeTables/menSizesComponent.vue?vue&type=style&index=0&scoped=b3a7a073&lang.scss +0ms
Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

More info: https://sass-lang.com/d/legacy-js-api

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions