-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Command
build, serve
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
With @angular-devkit/build-angular:browser executor the build worked. Sass imports also worked if I used this way:
@use 'libs/shared/components/src' as components;
With @angular-devkit/build-angular:application, the build is failed because of:
[ERROR] Can't find stylesheet to import.
╷
2 │ @use 'libs/shared/components/src' as components;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
apps/scaffold/src/styles.scss 1:1 root stylesheet [plugin angular-sass]
With style including option I'm able to include third party css libs and monorepo libs as well, but I have to change the path everywhere in apps and in libs as well to relative paths instead of using paths from root:
libs/shared/css-lib -> ../../../libs/shared/css-lib OR ../../../../../libs/shared/css-lib
Desired solution:
Changing to @angular-devkit/build-angular:application executor could use the same css imports:
@use 'libs/shared/components/src' as components;
OR same imports what we can use in ts files;
@use '@shared/lib' as components;
Minimal Reproduction
- Create a monorepo (with nx)
- create an app
- create a sass library
- use the sass library css inside the app with path
libs/path/to/lib
or with@shared/lib
- see error in console after run build target
Exception or Error
[ERROR] Can't find stylesheet to import.
╷
2 │ @use 'libs/shared/components/src' as components;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
apps/scaffold/src/styles.scss 1:1 root stylesheet [plugin angular-sass]
Your Environment
@angular/xxx -> 17.1.1.
@angular-devkit/xxx -> 17.1.1
@nx/angular -> 18.0.1.
Anything else relevant?
With @angular-devkit/build-angular:browser-esbuild the result is the same. Perhaps it is the same issue in both cases.
Probably these esbuild based executors are not prepared to sass/css imports in a monorepo.