-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Each build of an Angular library is missing random files in the output folder #15952
Comments
@JGH153, I tried to take a look at this add did several runs with the reproduction you provided by I always managed to get 12 component files.
I am too running on a windows machine. |
What I am seeing strange is that if one of the files is missing the build will fail because to generate the FESM 2015 and FESM 5 bundles all files needs to be on disk. I am thinking that you might be having a background process that is deleting the files after the build. Maybe a too strict anti-virus or something along this source. |
Ok so the missing files needs to be present during the build step for it to work. That's a really helpful clue. Never had my anti-virus delete files like that, but I’ll give it a try. And I’ll also terminate any other processes that potentially can delete the files and see if the problems persists. |
I have the same problem sometimes. In my case, most of the time it's some random files under lib (the definition files) that are missing, bundles/esm/fesm seem to be ok. I also have the feeling that the problem occurs more often with files nested in folders. Example:
This problem also occurs when doing the build in watch mode. The files that are missing in watch mode will not get built as long as you don't touch them manually (do some changes to the file), so for me it seems that the cli just misses them out until someone points them out to it again. |
@dummdidumm can you please elaborate a bit more on the below statement.
|
When a file is not part of the output under The situation of not having all files under lib occurs more often if i have my main app running ( I also sometimes get "operation not permitted"-errors like this when trying to build the library, maybe this is related:
npm error log:
|
Found the cause of the bug. I get missing files 100% of the time when I use the Angular language service plugin for vscode AND have one or more files in the library open during a build of the library (for example app-shell). Disabling the plugin gives all files always after more than 20 runs. Should I file this issue with vscode-ng-language-service? |
Seems to be a well known bug: ng-packagr/ng-packagr#837 (comment) Adding "exclude": ["dist"] to tsconfig and running the library build/watch from a terminal with administrative privileges seems like it solved the problem with missing files and the language service |
If part of the problem (if not all) is solved by adding |
The workaround was more stable, but broke down as well in the end. Had to disable the plugin |
We definitely should exclude |
This should have been fixed with the latest v0.900.0 extension, which is already published. This issue has the same underlying root cause as angular/vscode-ng-language-service#224, which is now closed. |
Currently the library schematic doesn't support adding a secondary entry-point and having deep imports is not recommanded. It's best if paths are more stricter when having a secondary entry-point instead of a wildcard. Instead of : ``` "lib/*": [ "dist/lib/*" ] ``` Users should configure: ``` "lib/secondary": [ "dist/lib/secondary" ] ``` This would allow a better DX experience when using auto imports in IDE's. Closes: #15952
Currently the library schematic doesn't support adding a secondary entry-point and having deep imports is not recommanded. It's best if paths are more stricter when having a secondary entry-point instead of a wildcard. Instead of : ``` "lib/*": [ "dist/lib/*" ] ``` Users should configure: ``` "lib/secondary": [ "dist/lib/secondary" ] ``` This would allow a better DX experience when using auto imports in IDE's. Closes: #15952
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?
First time creating library myself, but I have never seen this bug in other libraries.
Description
Each run of my library (ng build hal-components) (my library) is missing random files in the dist/hal-components/lib folder. A few runs gives me all files, but most (ca 90%) is missing several files. The files missing changes on each run.
Restarting the computer temporarily solves the problem, but it returns after a few hours to one days of use without a restart
Still get the bug if I stop the ng serve command on the consuming project. I get the bug both with, and without the watch flag.
This bug is really annoying as I need to manually check if all files are present before publishing to NPM.
🔬 Minimal Reproduction
Library is still tiny so I can link to it:
https://github.com/hafslundnett/hal-components/tree/build-bug
Only getting the bug on Windows (also tested on Mac, but did not get the bug).
Bug is periodic, but what I do is:
yarn
ng build hal-components
dist/hal-components/lib
for missing components from the library🔥 Exception or Error
There is no error, just random missing files.
🌍 Your Environment
Anything else relevant?
Running the latest version of Windows 10 Enterprise.
I understand this will be hard to solve, so I appreciate any workaround as a solution if anyone has a suggestion.
The text was updated successfully, but these errors were encountered: