How to pass SASS option to Angular library builder
Asked Answered
D

1

9

I have an Angular 11 library using Bootstrap 4.5
ng-packagr uses SASS 1.34 which yields a lot of warning about the deprecation of the division operator, which is used a lot in Bootstrap (https://sass-lang.com/documentation/breaking-changes/slash-div)

The warning in question:

DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

There is an option : --quiet-deps that can be used when manually executing sass, to hide these warnings.

My question is, how and where to pass this option when building the Angular library ?
It didn't find any possible configuration for the ng build command or in the ng-package.json file

Devotion answered 4/6, 2021 at 12:29 Comment(5)
Please include an example of the warning in your post for searchability purposes. Is this github issue? Seems sass don't like supporting suppression of warnings github comment and bootstrap may fix this pretty soon so the solution may end up being update to v5.1.0 when this comes alongAbramabramo
Edited to add the warning. I know Bootstrap 5 will fix the issue, but it is not a solution, a lot of plugins are not yet compatible with v5. As I said there are options to mute sass (quietDeps and quiet) I just don't know how to pass them trough the Angular build chain.Devotion
The Node API of Dart SASS does not expose the quietDeps options at all.... github.com/sass/sass/issues/3065Devotion
Doesn't directly solves your issue, but this worked for me: https://mcmap.net/q/63724/-how-do-i-override-nested-npm-dependency-versionsFootle
@AndrewShustariov thanks, using yarn this works natively "resolutions": { "**/ng-packagr/sass": "~1.32.13" }Devotion
R
3

As far as the CLI release notes for 12.1.2 go this feature was added as a fix for this issue. By simply omitting --verbose from your build command should result in no warnings.

(Run npm list -g @angular/cli and npm list @angular-devkit/build-angular to see the versions you are using.)

Rutharuthann answered 16/7, 2021 at 13:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.