Is this a regression?
The previous version in which this bug was not present was
No response
Description
The current implementation of ng-add adds an entry to the angular.json styles array for whichever prebuilt style was selected, and that entry is a relative path involving node_modules, which doesn't work with yarn pnp.
Per this discussion, styles added to an application's angular.json work with module resolution, but not with styles exported via package exports, which is the case for the prebuilt styles.
e.g.
"./prebuilt-themes/indigo-pink.css": {
"style": "./prebuilt-themes/indigo-pink.css"
},
I'm not sure what can be done to adjust this right now, until the module resolution for angular.json will work with package exports, (unless you think adding the style import to the styles.css/scss is preferable. I personally don't think it is). But once it does support exports, I believe the styles path in
|
function insertPrebuiltTheme(project: string, theme: string, logger: logging.LoggerApi): Rule { |
will need to be adjusted to something like
"@angular/material/prebuilt-themes/indigo-pink.css"
Expected Behavior
Ng Add should create a configuration that is compatible with yarn pnp
Actual Behavior
It doesn't currently.
Environment
- Angular: 14.0.5
- CDK/Material: 14.0.4
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
Is this a regression?
The previous version in which this bug was not present was
No response
Description
The current implementation of
ng-addadds an entry to theangular.jsonstyles array for whichever prebuilt style was selected, and that entry is a relative path involvingnode_modules, which doesn't work with yarn pnp.Per this discussion, styles added to an application's
angular.jsonwork with module resolution, but not with styles exported via packageexports, which is the case for the prebuilt styles.e.g.
I'm not sure what can be done to adjust this right now, until the module resolution for
angular.jsonwill work with packageexports, (unless you think adding the style import to thestyles.css/scssis preferable. I personally don't think it is). But once it does supportexports, I believe the styles path incomponents/src/material/schematics/ng-add/theming/theming.ts
Line 111 in b5c935a
"@angular/material/prebuilt-themes/indigo-pink.css"Expected Behavior
Ng Add should create a configuration that is compatible with yarn pnp
Actual Behavior
It doesn't currently.
Environment