Hello, everybody! Let me try to put this in one (maybe run-on) sentence: If 
I have multiple Angular apps inside of a project and I have a *lib* folder 
in which I want to share NgModules between my Angular apps, the compiler 
seems to correctly generate "module factories" for those external modules, 
but does not generate correct paths to the modules for the factories.

So, I've decided to reach to the internet for help. I've created a project 
demonstrating the behavior I am talking about at that anyone can access on 
my GitHub.
https://github.com/ItsBaneDude/broken-external-links

My npm scripts are
npm run build-aot // ng build prodEnter code here..
npm run build-jit // ng build dev
npm run compile-aot // ngc

To see the compile error, run 
npm run build-aot
and you should receive something along the lines of:
ERROR in C:/Users/Bane/Documents/node_projects/broken-external-libs/src/
project-ng/aot/lib/modules/test/test.module.ngfactory.ts (10,21): Cannot 
find module './test.module'.

I decided to examine the AoT code out of curiosity, so I ran
npm run compile-aot
and my compiled factories were output in src/project-ng/aot.

Examining the primary app module in .../aot/app/app.module.ngfactory.ts, 
you can see on line 10 
import * as i1 from '../../app/app.module';
and ../../app/app.module.ts resolves successfully.

However, going back to the lib folder under the aot output directory 
.../aot/lib/test/test.module.ngfactory.ts, on line 10 again, the module 
import is
import * as i1 from './test.module';
which, as we know, the source for the test module is back at 
../../../../../lib/modules/test/test.module.ts.

I do not understand why this is happening, and this is probably due to my 
being relatively inexperienced with Angular. Am I expecting a behavior to 
happen which is met under different conditions, or is outside of the 
intended functionality of the Angular compiler? I am unsure if this would 
be appropriate to inquire on the Angular GitHub issues page, so I figured I 
would ask around first. Thank you in advance for any lent expertise.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to