Skip to content

bug(Style): Enabling preserveSymlinks breaks stylesheet #25122

Closed as not planned

Description

@myrddraall

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

13

Description

when enabling preserveSymlinks in angular.json custom stylesheets no longer compile because they cannot find @material/button/button

Reproduction

Steps to reproduce:

  1. Run ng new MyProject
  2. Select the default options
  3. Run cd MyProject
  4. ng add @angular/material
  5. Select the default options, except for the theme, select Custom
  6. Set preserveSymlinks to true in angular.json
  7. Run ng build

Expected Behavior

For the project to build without error

Actual Behavior

The build fails with the following message:

./src/styles.scss - Error: Module build failed (from ./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
2 │ @use '@material/button/button' as mdc-button;
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  node_modules/@angular/material/button/_button-theme.scss 2:1               @use
  node_modules/@angular/material/core/density/private/_all-density.scss 2:1  @forward
  @angular/_index.scss 18:1                                                  @use
  src/styles.scss 1:1                                                        root stylesheet

Environment

Angular CLI: 15.1.4
Node: 18.13.0
Package Manager: pnpm 7.26.2
OS: linux x64

Angular: 15.1.3
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, material-date-fns-adapter, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1501.4 (cli-only)
@angular-devkit/build-angular 15.1.4
@angular-devkit/core 15.1.4 (cli-only)
@angular-devkit/schematics 15.1.4 (cli-only)
@angular/cli 15.1.4
@schematics/angular 15.1.4 (cli-only)
rxjs 7.5.6
typescript 4.9.5

Activity

  1. mto-siemensgamesa commented on Feb 21, 2023

    @mto-siemensgamesa

    I'm keeping an eye on this issue as I have the same issue, except I don't even have preserveSymlink set in my project. :) Would love to see what the cause could be.

  2. sramocki commented on Apr 11, 2023

    @sramocki

    I'm keeping an eye on this issue as I have the same issue, except I don't even have preserveSymlink set in my project. :) Would love to see what the cause could be.

    I'm seeing the same issue without preserveSymlink being set as well. Setting it to false doesn't fix the issue either.

  3. crisbeto commented on May 3, 2023

    @crisbeto
    Member

    This is likely an issue in the CLI. Moving to the appropriate repo.

  4. transferred this issue fromangular/componentson May 3, 2023
  5. self-assigned this
    on May 3, 2023
  6. alan-agius4 commented on Feb 15, 2024

    @alan-agius4
    Collaborator

    Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

    If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

  7. bruno-fonts commented on Feb 15, 2024

    @bruno-fonts

    Hi @alan-agius4, thanks for the update on this matter and for fixing this. Would you mind pointing us to the CLI version that should have resolved this? Would this be this latest 17.2.0 or already fixed somewhere in v16? Thanks 🙏

  8. angular-automatic-lock-bot commented on Mar 17, 2024

    @angular-automatic-lock-bot

    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.

  9. locked and limited conversation to collaborators on Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions