Dealing with Sass Deprecation Warnings in Angular 19

sass deprecation warnings with Angular 19 update

With the release of Angular 19, developers are seeing significant improvements, new features, and streamlined workflows.

Along with these enhancements, you might encounter deprecation warnings from the Sass compiler when building your project. These warnings can be confusing, especially if they originate from third-party libraries.

Table of Contents

Speed up your responsive apps and websites with fully-featured, ready-to-use open-source admin panel templates—free to use and built for efficiency.


Angular sass deprecation warnings

The output may resemble this:

▲ [WARNING] Deprecation [plugin angular-sass]

    src/scss/styles.scss:19:8:
      19 │ @import "custom";
         ╵         ^


  Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
  
  More info and automated migrator: https://sass-lang.com/d/import

  The plugin "angular-sass" was triggered by this import

    angular:styles/global:styles:1:8:
      1 │ @import 'src/scss/styles.scss';
        ╵         ~~~~~~~~~~~~~~~~~~~~~~

These warnings arise due to the sass compiler being updated to version 1.80.x, which enforces stricter checks.

How to disable sass deprecation warnings in Angular 19

The good news is that Angular 19 introduces helpful settings in the Sass preprocessor options that address issues related to deprecation warnings.

The subsequent options have been included to enhance Sass integration:

  • futureDeprecations: This option specifies features scheduled for deprecation. The compiler will treat these features as active and issue warnings accordingly.
  • fatalDeprecations: This option identifies Sass features already deprecated and will cause the build to fail.
  • silenceDeprecations: This option suppresses deprecation warnings for specific versions.

The last option allows developers to silence sass deprecation warnings in Angular 19.

To implement the necessary changes, simply incorporate the following configuration, stylePreprocessorOptions.sass.silenceDeprecations, into the architect.build.options section of your angular.json file, like this:

{
  "projects": {
    ...
      "architect": {
        "build": {
          "options": {
            "stylePreprocessorOptions": {
              "sass": {
                "silenceDeprecations": ["color-functions", "global-builtin", "import", "mixed-decls"]
              }
            }
          }
        }
      },
    ...
  }
}

This enhancement aims to address and mitigate any recently introduced Sass deprecation warnings. However, it is important to note that they do not address the root cause of the warnings but merely mute them.

References


About the Author

Subscribe to our newsletter
Get early information about new products, product updates and blog posts.
How to Achieve Perfectly Rounded Corners in CSS
How to Achieve Perfectly Rounded Corners in CSS

How to Add a Tab in HTML
How to Add a Tab in HTML

How to Open Link in a New Tab in HTML?
How to Open Link in a New Tab in HTML?

How to Clone an Object in JavaScript
How to Clone an Object in JavaScript

How to Fix “Sass @import Rules Are Deprecated and Will Be Removed in Dart Sass 3.0.0.”
How to Fix “Sass @import Rules Are Deprecated and Will Be Removed in Dart Sass 3.0.0.”

How to Remove Elements from a JavaScript Array
How to Remove Elements from a JavaScript Array