-
Notifications
You must be signed in to change notification settings - Fork 12k
ng build AOT + lazy loading from different package #5986
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
@chorew i have same issue, with regular lazy loading. |
Same issue here. Lazy loading to a library packages works fine with JIT, not with AOT. |
… because of this CLI AOT issue: angular/angular-cli#5986
... because of this CLI AOT issue: angular/angular-cli#5986 (Also work around Travis issue with recent NPM and Yarn.)
@hansl is this a bug or is there no support by design? |
BTW this is still the case with CLI 1.0.4. |
BTW this is still the case with CLI 1.0.6 |
BTW this is still the case with CLI 1.1.1 |
BTW this is still the case with "ngtools/webpack": "^1.5.0" |
@filipesilva is this not supported by design? |
@hansl can you chime in? |
Hi everyone, After some investigation and help from our compiler team, I was able to make progress to the point where it was working (see jpguevara/AngularSample#2). The last issue was that the library needs to be published with Angular as a peer dependency. By modifying the So everything can be fixed by the library side, and using the library name instead of pointing to the index file directly. It does not even require the latest version of the CLI. Closing this issue as working-as-intended. |
Hi @hansl, Thank you so much for some investigation in this problem. If i use @angular/cli and do not eject the webpack config do i still have the possibility to change somewhere the behavior like you done in the sample app? |
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 or Feature Request (mark with an
x
)Versions.
Windows 7 and MacOS
$ ng --version
@angular/cli: 1.0.0
node: 7.7.2
os: win32 x64
@angular/common: 4.0.2
@angular/compiler: 4.0.2
@angular/core: 4.0.2
@angular/forms: 4.0.2
@angular/http: 4.0.2
@angular/platform-browser: 4.0.2
@angular/platform-browser-dynamic: 4.0.2
@angular/router: 4.0.2
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.2
Repro steps.
Stack Overflow Question:
http://stackoverflow.com/questions/43441732/angular-2-error-when-ng-build-aot-lazy-loading-from-different-package
Sample Repo:
https://github.com/chorew/AngularSample
Running the app
const routes: Routes = [
{ path: 'library', loadChildren: '@myapp/library/src/index#ModuleAModule' } // lazy loading a module from a different package
];
The log given by the failure.
Notice how it is trying to find the lazy loaded module inside the
main.app\src
folderApp src path
C:\Users\Juan.Pablo\projects\POC\AngularSample\packages\main.app\src\
Lazy loaded from package
@myapp\library\src\index.d.ngfactory.ts
The text was updated successfully, but these errors were encountered: