-
-
Notifications
You must be signed in to change notification settings - Fork 198
Description
@isc30 commented on Sun Nov 11 2018
Environment
√ Component nativescript has 5.0.0 version and is up to date.
√ Component tns-core-modules has 5.0.2 version and is up to date.
√ Component tns-android has 5.0.0 version and is up to date.
√ Component tns-ios has 5.0.0 version and is up to date.
Describe the bug
Current version of Template Drawer Navigation (Angular) doesn't work well when running tns preview --bundle.
Error: com.tns.NativeScriptException: Failed to find module: "~/app/home/home.module", relative to: /app/
To Reproduce
Start a new project from the template and run tns preview --bundle
Expected behavior
It should run properly. With tns preview it works well, so its related to webpack.
@Fatme commented on Mon Nov 12 2018
Currently preview app has a limitation and does not support lazy loading with angular projects.
The error you receive is due to the fact that home module is lazy loaded here https://github.com/NativeScript/template-drawer-navigation-ng/blob/master/src/app/home/home-routing.module.ts#L12. If you want to run preview --bundle command with drawer navigation template, you need to refactor all places where lazy loading is used.
The another option is to create an application from tabs or hello world templates. These templates do not have lazy loading, so they will work automatically with tns preview --bundle command.
@isc30 commented on Mon Nov 12 2018
Lazy loading also prevents HMR, right?
Is it recommended to avoid lazy loading for now and take advantage of bundling and HMR? What's the best approach for the future?
Thanks a lot @Fatme