-
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
lazy loading chunks not built if bootstrap is not in main.ts file #12025
Comments
Is there a workaround? I need to call |
You can get around this by adding an That this is failing at runtime instead of throwing a compiler error is probably a bug in the Angular CLI, the relevant function in the Angular CLI source is bailing out with
|
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. |
…disabled At the moment this will cause a runtime error instead. With this change a warning will be shown during the build. Closes angular#12238 and Closes angular#12025
Currently if people want to use lazy loading within Angular CLI projects and their
bootstrap
code is not placed inside of the$PROJECT_ROOT/main.ts
file, the chunks for the lazy-loading module are not being generated.This leads to JIT runtime errors that indicate that the lazy module couldn't be found.
Moving the
boostrap
call to themain.ts
file fixes this issue (credits to @filipesilva for this finding)--
It would be good to have some warning or note that implicates that lazy modules won't be detected if the
bootstrap
call is placed somewhere else.Issue demonstration: https://github.com/DevVersion/lazy-load-test-cli
cc. @filipesilva
The text was updated successfully, but these errors were encountered: