angular / angular-cli Public
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
Yarn PnP Support Status #16980
Comments
|
Another way of making Angular 9 work with Yarn 2.0 is to use Yarn team is investing into |
|
Some possibly relevant information regarding improving yarn 2.0 support: Replacing I noticed that @clydin authored most of the code in that file, perhaps #14841 could be fixed in the process as well. |
|
How does 2.1 with node_modules linker improvements impact this issue? https://dev.to/arcanis/yarn-2-1-git-workspaces-focused-installs-loose-mode-live-playground-4kfc |
|
With |
|
I'm not suggesting it would be trivial to fix this and have it automatically work the way yarn 2 works by default out of box, in addition to continuing to support NPM... but I would say this would probably go a long ways to improve developer experience. Can't wait until node_modules (at least the way it works today) is a thing of the past. |
|
There is ongoing work right now in You can read more and track the progress here: angular/angular#38099 |
|
Since the above linked issue was closed we can track the progress here https://github.com/orgs/angular/projects/2 |
|
Is there any specific story for that? A lot of issues getting closed with sentence 'track progress here' but no one issue in this project has specific description from closing ones. |
@JoostK I'm interested in when this linker will be available and if it'll solve yarn 2.0 pnp support? The project board appears to be mostly complete, and with |
The linker functionality is indeed functionally working, but we're not yet ready to accept published libraries in this new way (we have yet to review the API that would eventually be published to NPM, which needs special considering as it needs to be backwards/forwards compatible). Regarding pnp support, I suspect that it requires that all dependencies no longer depend on ngcc to work correctly, as otherwise you'd still need ngcc which mutates It may be possible to test this support by manually compiling all dependent libraries using the new way and then seeing if that works, but I suppose that it wouldn't tell the whole story as it wouldn't download packages from NPM, which could arguably affect how pnp works. |
|
Sorry but is my understanding correct, that to make pnp works it's required for all angular libs to get updated by their maintainers? |
|
So does this mean Angular is dead in the water as it will always require management of gigs of dependencies, long CI build times, ngcc compilation, unextendible principles coupled with the insurmountable goal of updating every existing Angular library to support pnp functionality? Or is there a streamlined plan to modernize? It seems like nobody wants to take responsibility for these topics on pnp and everybody is just delegating. |
The plan is for the Angular packages (framework, CDK, Material, etc) to be published using partial-ivy format from Angular 13.0.0 onwards, to coincide with View Engine removal - assuming that all goes well with this approach during the 12.x active period. From that point on application developer will begin to be able to benefit setups that require you not to mutate node_modules, such as yarn2, pnpm, lerna, etc, as long as all the Angular libraries in their dependency tree are partial-ivy format. As long as any are still in View Engine format, then you still require ngcc, which will mutate node_modules. |
|
So how to suppose to build a lib? |
|
@wolftrax5 The globally installed |
|
thanks for the answer @bgotink, I tried, everything run well until the building part. Need to modify or add something on tsconfig.json? like here but with the ".yarn/cache /" |
In that case, would it be possible to get a new a new version of ngcc that doesn't mutate node_modules? |
Indeed we have introduced the new partially compiled Ivy format for Angular libraries. |
But how does exactly this help in getting support for Yarn 2.0? If I understand the situation correctly, making all of this work is a matter of storing ngcc's output somewhere other than node_modules, because it's the only thing (in Angular's own tools anyway) that mutate node_modules. |
|
The problem ngcc has is that build tools rely upon stuff in node_modules, such as TypeScript typings files ( Since we have a solution (partial compilation and linking) which indeed is designed to avoid the need to mutate node_modules, this is what we would like to move towards going forward. It is true that packages that do not update to publish in ivy format will lock downstream applications into using ngcc. So I would recommend that the best course of action is to lobby those library projects to migrate to the new format that will enable your application projects to drop ngcc. Angular itself will migrate its own published format to this in 13.0.0, since we will no longer have to support View Engine projects from that version onwards. |
|
Hi! Yarn 3.0 is released, any update for this and 2.0? |
|
So am i given to expect that this should then be somewhat working with the introduction of angular 13.0 later this year? |
|
I switched pnpm 1 year ago since I give up on yarn. I belive it faster than any other and you should give a chance to it |
|
Now that Angular 13 is released, with updates to angular-linker, are there any updates to this? |
|
The title of this issue is misleading, it should rather be |
|
Now that the main Angular packages are published in partial-ivy format, the path to using Yarn PnP is unblocked. |
|
I'm excited to have this as an option now! |
Any idea why I am still seeing ngcc running when running ng build in an Angular 13 app when ALL dependencies are either set to partial or full ivy compilation? |
|
@mikerentmeister If you are encountering an issue with |
|
So ngcc will run whatever your project setup, since it needs to check for ViewEngine packages. But if there are none there it should effectively be a noop. That being said, I think it may still create a manifest file of all the packages that it checked... |
It might result in an incompatibility with |
|
I believe there is only one problematic place in ngcc regarding "noop" writing to node_modules: writing a "lockfile" during parallel processing: export function getLockFilePath(fs: PathManipulation) {
return fs.resolve(require.resolve('@angular/compiler-cli/ngcc'), '../__ngcc_lock_file__');
}You can see that this is writing to the |
|
Based on seeing similar issues with other tools in the Node ecosystem, it is broadly safer to write into a node_module/.foo directory, versus inside of a node_modules/FOO/ directory. |
|
I'm looking forward to seeing an improvement to the size of Angular projects! Currently, node modules take up 300+ MB starting from an empty project. |
With the release of Yarn 2.0, many users may be interested in trying out the new version of the package manager with the Angular CLI. As of 9.0, the Angular CLI does not natively support Yarn 2.0 and its new package management strategy named Plug’n’Play (PnP). However, native support is currently and actively being investigated with several initial steps already in place. Native support is tentatively scheduled for inclusion in 10.0 or beyond with the goal of integrating new major versions of upstream dependencies that provide native support.
For those that are interested in experimenting with building applications using the new package manager, you can use the following instructions to workaround the current issues.
WARNING: This is not recommended for use with deployed applications and should not be used in a production environment.
pnpifypackage:yarn add -D @yarnpkg/pnpifyyarn unplug <package_name>. This should include at a minimum all@angularscoped packages.webdriver-managerpackage also needs to be unplugged:yarn unplug webdriver-managerOnce these steps are complete, Angular CLI operations such as serve or build can be used by executing
yarn pnpify ng buildoryarn pnpify ng serve, respectively.Please note that manually running the
ngcccommand with or without the pnpify utility does not currently work.If any issues are encountered using the workaround steps or for Yarn 2.0 in general, please open a separate issue detailing the problem.
The text was updated successfully, but these errors were encountered: