-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Library is skipped by Ivy / ngcc compiler #40357
Comments
I've transferred this to the Framework repo as that is where ngcc is maintained. I'll take a look at this issue tomorrow. |
@petebacondarwin thank you very much! I would appreciate any help |
@smnbbrv - I followed your instructions and I cannot reproduce the errors that you are seeing. (Note that I do not have
And when I look at the
which indicates that ngcc has converted this to Ivy. I wonder if you have some outdated files in |
I should also note that I see that |
@petebacondarwin Thank you very much for the review. It looks like the package.json was the issue. Clearing it up + node_modules fixed the issue. That weird. Again, many thanks! |
Great! I'm glad you are unblocked. |
Yep, sometimes the fix is so clear, and actually it's a shame I did not came to this on my own... It's always good to have a look from the outside :) |
OK, this is a bug and I found how to reproduce and work it around. First of all, the updated reproduction steps are:
Workaround:
@petebacondarwin is this intentional to have this file? Looks like it stores some metadata / state of the previous builds. Is there a better way to deal with it / safe way to clear it up, let's say some command like |
This is something that Angular CLI adds. See https://github.com/angular/angular-cli/blob/51d0178d244ed3fb6feee280d02cf284ceed1b85/packages/ngtools/webpack/src/ngcc_processor.ts#L70-L76 Transferring to the CLI repository to continue the discussion... |
It appears that the on-demand ngcc processing for that one library is partially failing. One of the |
Transferring to the FW repo as it appears to be a bug in NGCC path mapping logic. //cc @klemenoslaj |
I have found the source of the bug for #40352 - I'll check to see if this is the same problem. |
Previously, if an entry-point started with the string of another package that is included in `paths` mappings, then the base path was incorrectly computed resulting in the wrong package path for the entry point. Now we not only check whether the target path "starts with" the base path but then also whether the target path is actually contained in the base path from a file-system directory point of view. Fixes angular#40352 Fixes angular#40357
Looks like #40376 solves this issue too. 🎉 |
Previously, if there were path-mapped entry-points, where one contaied the string of another - for example `worker-client` and `worker` - then the base paths were incorrectly computed resulting in the wrong package path for the longer entry-point. This was because, when searching for a matching base path, the strings were tested using `startsWith()`, whereas we should only match if the path was contained in a directory from a file-system point of view. Now we not only check whether the target path "starts with" the base path but then also whether the target path is actually contained in the base path using `fs.relative()`. Fixes angular#40352 Fixes angular#40357
…40376) Previously, if there were path-mapped entry-points, where one contaied the string of another - for example `worker-client` and `worker` - then the base paths were incorrectly computed resulting in the wrong package path for the longer entry-point. This was because, when searching for a matching base path, the strings were tested using `startsWith()`, whereas we should only match if the path was contained in a directory from a file-system point of view. Now we not only check whether the target path "starts with" the base path but then also whether the target path is actually contained in the base path using `fs.relative()`. Fixes #40352 Fixes #40357 PR Close #40376
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
I'm not sure. Upgraded to angular 11 almost together with getting the issue - might be.
Description
I maintain a set of libraries to work with gRPC from Angular, here is the link: https://github.com/ngx-grpc/ngx-grpc
The lib includes 6 libs (located in
packages
):protoc-gen-ng
worker
.There is also
examples
directory served as example and, well, as a test reference that all goes fine. This example uses all the libs, and this is the place where the error is happening.Now I added a module with forRoot / forChild in some of the angular libraries: core (2 modules), grpc-web-client (1 module) and worker-client (1 module). All modules and libs are working fine, all, but the latter one. It is just not processed by
ngcc
. When I start the application I see the following:So, the ngcc reaches the library, but the directory
__ivy_ngcc__
is not created indist/worker-client
, however for all other modules it is created. The outcome is that the latter library does not work.What I tried:
Worker
type fromworker-client
- did not helpgrpc-web-client
worker
library fromworker-client
- did not helpworker-client
togrpc-web-client
lib. This made the code work, meaning that thegrpc-web-client
had no problems with ngcc; and I can use the code in the example and it works just fine. However, I cannot get more out of it; I still need the code in a separate package. This also means that code is valid and it can be compiled by ngcc, but for some reason when it's in its own package it does not.What is also very weird - I would not be surprised if I had problems with
worker
library; it's built by Angular and used in Worker. And I have a feeling it can be connected to the issue.I don't know what / where else to dig. The issue is driving me crazy. It seems unlogical to me and I cannot find the reason.
Please help me out.
🔬 Minimal Reproduction
npm ci
npm run build
- builds the libsnpm run examples
- produces the error after ngcc compiler🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
I'm not sure wheher the issue belongs to @angular/cli, please feel free to locate it properly in case it's necessary
The text was updated successfully, but these errors were encountered: