-
Notifications
You must be signed in to change notification settings - Fork 12k
Angular AOT application will not build with AOT set to true in the angular.json file #13820
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
Comments
Additional information since apparently I did not use the template correctly. Minimal Reproduction: You will get the error messages above. This is not an upgrade and the project was created specifically for this test since I am having this problem in a real project. I would expect dependency resolution and scoping to work the same regardless of optimization. Here is a GitHub repro project: https://github.com/brucekbenton/AotTest |
Still learning the interface:-) Did not mean to close the issue |
Hi @brucekbenton, the main issue here is that your libraries are named kebab cases example The imports and path mappings in the tsconfig should be kebab-case. This was a problem with older versions of the CLI. I suggest that you update to the latest version of the CLI and it's dependencies. Duplicate of #11017 |
Since I am getting ready to do a large release at this time I don't really want to upgrade my entire environment. Therefore, I tracked down exactly what needed to get updated to resolve the dependency issues. I had to make configuration changes for each entity generating the error message above (service or component). In this simple repro that means I needed to make these changes for comp-container. I made the following changes:
I did not make any updates to angular.json or change any of the selector references or file names. I also did this for my actual project which consisted of several services and components and it worked there as well. For my simple project I did not actually have to make the ng-package.json and package.json updates but I seemed to need it for my more complicated real project. |
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?
This is new to the Angular work space so it is the first time I have tried itDescription
When creating an angular cli worskspace containing multiple libraries, cross library dependencies work in the non AOT compiled build but fail in the build when the AOT=true flag is set in the angular.json file. Error message is:
"Error in c:/Users/bruce.benton/Source/Repos/AotTest/dist/comp-container/comp-container.ngfactory.js
Module not found: Error: Can't resolve 'comp-container' in 'C:\Users\bruce.benton\Source\Repos\AotTest\projects\application1\src\ass'
This is not an upgrade issues and happens in a new work space created from scratch.
🔬 Minimal Reproduction
🔥 Exception or Error
The text was updated successfully, but these errors were encountered: