docs: Add documentation about the CLI failing (#35385)

The CLI seems to throw very non-descriptive errors. Adding a section to help users troubleshoot lazy-loading modules.

PR Close #35385
This commit is contained in:
Brandon Winchester 2020-02-12 09:54:32 -06:00 committed by Joey Perrott
parent 529f0a83cb
commit 7fa881919b
1 changed files with 7 additions and 0 deletions

View File

@ -322,6 +322,13 @@ ngOnInit() {
For more information with a working example, see the [routing tutorial section on preloading](guide/router-tutorial-toh#preloading-background-loading-of-feature-areas).
## Troubleshooting lazy-loading modules
A common error when lazy-loading modules is importing common modules in multiple places within an application. You can test for this condition by first generating the module using the Angular CLI and including the `--route route-name` parameter, where `route-name` is the name of your module. Next, generate the module without the `--route` parameter. If the Angular CLI generates an error when you use the `--route` parameter, but runs correctly without it, you may have imported the same module in multiple places.
Remember, many common Angular modules should be imported at the base of your application.
For more information on Angular Modules, see [NgModules](guide/ngmodules).
## More on NgModules and routing