Skip to content

Scss error after upgrading to Angular 15 #25266

@shammy8

Description

@shammy8

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

No

Description

I have an app which uses @momentum-ui/core, after upgrading to Angular 15 it's throwing the error below when running npm start.

I know in Angular 13 tilde in Scss was deprecated but we're only seeing this error with Angular 15. Did something happen during 15 which might have caused this error? I can't seem to see anything in the change log which might indicate this.

After messing around with the minimal reproduction repo below I managed to get it to compile successfully by removing 2 specific Scss tildes in node_modules/@momentum-ui/core, there are other tildes still present. I have specified which ones exactly in the repo in app.component.html. I also had to use @ use instead of @ import like they mention under the usage section of their npm page.

So it looks like a Scss tilde issue but how come we are seeing it now and are there any work around in the mean time?

Please provide a link to a minimal reproduction of the bug

https://github.com/shammy8/test-momentum-core-with-angular-15

Please provide the exception or error you saw

./src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: SassError: Error: The "path" argument must be of type string. Received an instance of TypeError
  ╷
6 │ @import "@momentum-ui/core/scss/momentum-ui";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src\styles.scss 6:9  root stylesheet

./src/styles.scss?ngGlobalStyle - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
HookWebpackError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: SassError: Error: The "path" argument must be of type string. Received an instance of TypeError
  ╷
5 │ @import "@momentum-ui/icons/scss/momentum-ui-icons.scss";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src\styles.scss 5:9  root stylesheet

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.2.8
Node: 16.17.0
Package Manager: npm 8.15.0
OS: win32 x64

Angular: 15.2.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.8
@angular-devkit/build-angular   15.2.8
@angular-devkit/core            15.2.8
@angular-devkit/schematics      15.2.8
@angular/cli                    15.2.8
@schematics/angular             15.2.8
rxjs                            7.8.1
typescript                      4.9.5

Anything else?

The error does not seem to occur in StackBlitz

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions