Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylePreprocessorOptions.includePath is not following symlinks when using @angular-devkit/build-angular:application #27353

Closed
1 task done
mjamin opened this issue Mar 25, 2024 · 1 comment · Fixed by #27355
Labels
angular/build:application freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix

Comments

@mjamin
Copy link

mjamin commented Mar 25, 2024

Command

build, serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

Description

I'm trying to include an .scss file from an external project that is symlinked into my angular project for development purposes.

Given the library symlink in this path:

<project-root>/lib/@scope/(->library)/_index.scss

and this configration in angular.json:

"stylePreprocessorOptions": {
  "includePaths": [
    "lib",
    "node_modules"
  ]
}

referencing the stylesheet like this:

@use '@scope/library' as lib;

does not work using @angular-devkit/build-angular:application.

It does however work using @angular-devkit/build-angular:browser.

Minimal Reproduction

  • Create a new angular project
  • Add a lib folder.
  • Add a symlinked directory to the lib folder
  • Add lib to stylePreprocessorOptions.includePaths
  • Reference an .scss file from the symlinked directory.
  • Run ng serve.

Exception or Error

✘ [ERROR] Can't find stylesheet to import.
  ╷
1 │ @use '@scope/lib' as lib;
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src\styles.scss 1:1  root stylesheet [plugin angular-sass]

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

Your Environment

Angular CLI: 17.3.0
Node: 20.11.1
Package Manager: npm 10.2.4
OS: win32 x64

Angular: 17.3.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, material, material-luxon-adapter, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.0
@angular-devkit/build-angular   17.3.0
@angular-devkit/core            17.3.0
@angular-devkit/schematics      17.3.0
@schematics/angular             17.3.0
rxjs                            7.8.1
typescript                      5.4.2
zone.js                         0.14.4

Anything else relevant?

The behavior is different when explicitly referencing the stylesheet like this:

@use '@scope/library/_index.scss' as lib;

or

@use '@scope/library/index' as lib;

Then it finds the file within node_modules where it is also present (since the library I'm symlinking into my project is normally a regular npm dependency). So @use '@scope/library' as lib; throws an error, @use '@scope/library/_index.scss' as lib; ignores the symlink and finds the file elsewhere.

@mjamin mjamin changed the title stylePreprocessorOptions.includePath is not working with symlinks when using @angular-devkit/build-angular:application stylePreprocessorOptions.includePath is not following symlinks when using @angular-devkit/build-angular:application Mar 25, 2024
@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity3: broken angular/build:application labels Mar 25, 2024
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Mar 25, 2024
…d SCSS files

This commit addresses a bug where SCSS files within linked directories were not being resolved correctly by the Angular CLI. By implementing the necessary adjustments, linked SCSS files are now properly resolved.

Closes angular#27353
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Mar 25, 2024
…d SCSS files

This commit addresses a bug where SCSS files within linked directories were not being resolved correctly by the Angular CLI. By implementing the necessary adjustments, linked SCSS files are now properly resolved.

Closes angular#27353
alan-agius4 added a commit that referenced this issue Mar 25, 2024
…d SCSS files

This commit addresses a bug where SCSS files within linked directories were not being resolved correctly by the Angular CLI. By implementing the necessary adjustments, linked SCSS files are now properly resolved.

Closes #27353
alan-agius4 added a commit that referenced this issue Mar 25, 2024
…d SCSS files

This commit addresses a bug where SCSS files within linked directories were not being resolved correctly by the Angular CLI. By implementing the necessary adjustments, linked SCSS files are now properly resolved.

Closes #27353

(cherry picked from commit e22d677)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
angular/build:application freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Projects
None yet
2 participants