preboot / angular-webpack

A complete, yet simple, starter for Angular v2+ using webpack
MIT License
1.29k stars 556 forks source link

Adding lazy loading component/module to the project #307

Closed todorpr closed 7 years ago

todorpr commented 7 years ago

I used this project as a starting point to integrate a lazy loading module and realized something was wrong as always I got this error:

EXCEPTION: Uncaught (in promise): Error: Cannot find module 'app/lazy/lazy.module'.

Error: Uncaught (in promise): Error: Cannot find module 'app/lazy/lazy.module'.

Then after few hours searching the problem I found in this thread that webpack needs angular2-router-loader module in order to recognize the lazy loaded module. So, I added this module to the webpack config as well as created a lazy loaded module in the project.

Foxandxss commented 7 years ago

Thanks @todorpr. I will close this PR but leave it as inspiration.

I want to do an experimental branch with big big changes and include there lazy and AOT. So I just don't want to have this master branch with those changes just yet because I will probably change them altogether.

Thisen commented 7 years ago

I just wanna add that I sat with this problem for several hours, before finding out that a webpack loader was needed. I think you should merge this PR to showcase lazy loading and then do it your way at a later point.