Angular upgrade own library from 12 to 13 scss Error 'SassError: Can't find stylesheet to import.'

Viewed 2063

I'm trying to upgrade my Angular projects from 12 to 13 and running into an issue that I cannot fix since two days of work.

My applications are default Angular Material apps with some functionality like a grocery list app.

To insert items I use a formula with some fields which can be submitted. (MatDialog) I have outsourced this formula into my own angular library to be a little bit more generic and reusable.

Now, after upgrading the library project and trying to link the resulting build (from new Ivy) into my app I'm getting the error:

SassError: Can't find stylesheet to import.

@import '@my/form-lib/theme';

The stylesheet which is meant to be unknown comes from the library and provides the default theming access to this library but I cannot determine why this should happen. I also recognized, that the use of Angular Material now doesn't need the tilde ~ anymore.

@use '**~**@angular/material' as mat;

I have tried to remove all tilde ~ but the error still exists.

I also have tried to reset @angluar/cli to 13.0.0 which is described as a solution here.
But this doesn't work for me.

Does anyone know a solution to try out?

1 Answers

the only thing that fixed it for me it's been changing from

@import '@my/lib/scss-file';

to

@import 'node_modules/@my/lib/scss-file';
Related