You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ivy] lazy loaded modules can not be found / imported #28866
So, your app is not configured for ivy correctly. Since you don't seem to have used the --experimental-ivy cli option (which automatically takes care of things for you, you need to make some manual adjustments. See #28569 for more details.
Once you do that, there is still an error about JIT compilation, but it is really hard to debug with so much going on in the app. (It could also be an @angular/cli issue.)
I suggest you remove all extra modules/features and start adding them one by one until the error comes up; in other words build a minimal reproduction.
Closing for now, but please do open a new issue (with a minimal reproduction 🙏) if you determine there is a bug in using ivy.
setting "aot":true in my angular.json build and "enableIvy":true in my tsconfig.app.json still didn't really fix the problem, its the same error except now its generated in the console at build time due to AoT.
first, I got another error that was not there before
ERROR in : Template parse errors:
The pipe 'async' could not be found ("argin:3px;" (click)="increment()">Increment</button>
<div style="margin:3px;">Current Count: {{ [ERROR ->]counter | async }}</div>
<button style="margin:3px;" (click)="decrement()">Decrement</button>
"): /Users/khaledosman/Documents/github/advanced-angular-demo/client/src/app/redux/redux.component.ts.ReduxComponent.html@3:47
because it couldn't get the async pipe... Then I commented out the div that's using the async pipe to see if the actual problem was fixed, then I got the module not found error again but now on compilation time instead due to AoT
ERROR in ./src/$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/app/chat/chat.module.ngfactory.js' in '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/$$_lazy_route_resource'
ERROR in ./src/$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/app/css-variables-sandbox/css-variables-sandbox.module.ngfactory.js' in '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/$$_lazy_route_resource'
ERROR in ./src/$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/app/react/react.module.ngfactory.js' in '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/$$_lazy_route_resource'
ERROR in ./src/$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/app/redux/redux.module.ngfactory.js' in '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/$$_lazy_route_resource'
ERROR in ./src/$$_lazy_route_resource lazy namespace object
Module not found: Error: Can't resolve '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/app/sw-sandbox/sw-sandbox.module.ngfactory.js' in '/Users/khaledosman/Documents/github/advanced-angular-demo/client/src/$$_lazy_route_resource'
this is literally a demo app, I don't know how more minimal than that it can get, there're no external dependencies in the app besides ngRx and socket.io, everything else is typical angular dependencies.
Its a problem with lazyloading and ivy, Everything works fine if I get-rid of lazyloading and load the modules upfront. And lazy-loading works fine if I opt-out of ivy and downgrade my angular versions.
You also need to add "allowEmptyCodegenFiles": true in angularCompilerOptions in tsconfig.app.json. This is a temporary workaround and should not be necessary soon.
I thought this was mentioned in #28569 (maybe it used to, but I don't see it now 😕).
Activity
gkalpak commentedon Feb 20, 2019
Are you trying to use the experimental ivy?
khaledosman commentedon Feb 20, 2019
yup
gkalpak commentedon Feb 20, 2019
So, your app is not configured for ivy correctly. Since you don't seem to have used the
--experimental-ivycli option (which automatically takes care of things for you, you need to make some manual adjustments. See #28569 for more details.Once you do that, there is still an error about JIT compilation, but it is really hard to debug with so much going on in the app. (It could also be an
@angular/cliissue.)I suggest you remove all extra modules/features and start adding them one by one until the error comes up; in other words build a minimal reproduction.
Closing for now, but please do open a new issue (with a minimal reproduction 🙏) if you determine there is a bug in using ivy.
khaledosman commentedon Feb 21, 2019
setting
"aot":truein my angular.json build and"enableIvy":truein my tsconfig.app.json still didn't really fix the problem, its the same error except now its generated in the console at build time due to AoT.first, I got another error that was not there before
because it couldn't get the async pipe... Then I commented out the div that's using the async pipe to see if the actual problem was fixed, then I got the module not found error again but now on compilation time instead due to AoT
this is literally a demo app, I don't know how more minimal than that it can get, there're no external dependencies in the app besides ngRx and socket.io, everything else is typical angular dependencies.
Its a problem with lazyloading and ivy, Everything works fine if I get-rid of lazyloading and load the modules upfront. And lazy-loading works fine if I opt-out of ivy and downgrade my angular versions.
gkalpak commentedon Feb 21, 2019
You also need to add
"allowEmptyCodegenFiles": trueinangularCompilerOptionsintsconfig.app.json. This is a temporary workaround and should not be necessary soon.I thought this was mentioned in #28569 (maybe it used to, but I don't see it now 😕).
khaledosman commentedon Feb 21, 2019
That actually fixed it, thanks!
angular-automatic-lock-bot commentedon Sep 14, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.