Open jamesrusso opened 1 year ago
+1 for this, it's the last blocker for us moving to Yarn PnP, which would be really valuable for us, mainly because installing packages is currently a large part of our CI (dockerised) build time, and Yarn PnP is significantly faster for installing packages from a lockfile without any packages in cache.
+1 for this from me, as well. Using pnpify utility circumvents the problem so we can still use PnP, but it would, of course, be better if we can do without it.
Looking through the code base, I think this file needs to be modified: https://github.com/angular/angular-cli/blob/main/packages/angular/build/src/utils/resolve-assets.ts
I think it can be fixed by adding an additional option like 'source: file | module' or something like that and using path.dirname(require.resolve("moduleName/package.json"));
in case if it is a module (but I am not a node expert). Or, alternatively, it can first try to get the asset directly from the file and then try checking if it is in the module.
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
It does not appear to be possible to include assets and paths from a yarn pnp package.
It seems that build-angular builder supports pnp package resolution for styles, but not assets.
I would expect the assets path (dictionary specification option) to work to copy paths from pacakges in the pnp environment.
Minimal Reproduction
% ng new test-yarn-example --style scss --no-routing % cd test-yarn-example % yarn add ng2-pdfjs-viewer
Next, add the path to the angular.json.
Just adding the string will result in the error saying it must be in the project source root.
Adding the dictionary version, yields no error but does not copy the assets either.
% yarn build
Exception or Error
Your Environment
Anything else relevant?
No response