ng-packagr / ng-packagr

Compile and package Angular libraries in Angular Package Format (APF)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: "Can't find stylesheet to import" when using Yarn PnP

michaelfaith opened this issue · comments

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

When migrating our library to use Yarn PnP, it's no longer resolving the @angular/material sass api at build time. This resolved fine prior to the pnp shift. @angular/material is declared as a peer dependency of the library (and installed as devDep for testing)

× Compiling with Angular sources in Ivy partial compilation mode.
Can't find stylesheet to import.

6 │ @use '@angular/material' as mat;
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

How To Reproduce

In a library project within a repo using yarn pnp, try using the root sass api from @angular/material within a component's stylesheet.

@use '@angular/material' as mat;

When building, it should fail to resolve.

Expected Behaviour

Should build successfully

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr: 16.1.0
@angular/*: 16.1.2
typescript: 5.1.6
rxjs: 7.8.1
node: 16.19.0
yarn: 3.6.0

Related: loading styles from the angular.json for app builds was addressed here: angular/angular-cli#23971