Closed phatakrajan closed 5 years ago
HI @phatakrajan,
This error can appear if you have import rxjs
module in some of your Angular component or modules like this -> import 'rxjs/add/observable/of'
.
To solve the issue, you can remove the rxjs
import or replace it with import {of} from 'rxjs'
.
@tsonevn That was indeed right observation. I had one entry remaining. However the issue I am facing with lazy loading still does not go away. After looking at stack traces I find that something is getting loaded via incorrect path.
System.err: Error: com.tns.NativeScriptException: Failed to find module: ".", relative to: app/tns_modules/
System.err: com.tns.Module.resolvePathHelper(Module.java:146)
System.err: com.tns.Module.resolvePath(Module.java:55)
System.err: com.tns.Runtime.runModule(Native Method)
System.err: com.tns.Runtime.runModule(Runtime.java:553)
System.err: com.tns.Runtime.run(Runtime.java:545)
System.err: com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
System.err: android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
System.err: android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
System.err: android.app.ActivityThread.-wrap2(ActivityThread.java)
System.err: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
System.err: android.os.Handler.dispatchMessage(Handler.java:102)
System.err: android.os.Looper.loop(Looper.java:154)
System.err: android.app.ActivityThread.main(ActivityThread.java:6119)
System.err: java.lang.reflect.Method.invoke(Native Method)
System.err: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
System.err: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
System.err: File: "
Please note that i had existing code structure which directly had app folder (code structure created with NS 3.4.1) .As per new code structure, path is src/app/modules/shared. However stack trace shows that these modules are getting loaded via incorrect path. The way i am migrating is that i created a new codebase via tns create command and am now porting my modules in new code. Is there any setting that i need to validate?
Hi @phatakrajan, Can you send us the project sample one, which can be used for debugging?
@tsonevn Added you as a collaborator on my project. I am getting error in sample project as well.
@tsonevn I learnt from NativeScript website that we need to use paths with ~ while specifying module paths. It resolved my problem in test app. However if I repeat the same in my actual production app, I still get same error. Any idea?
Hi @phatakrajan,
I was able to recreate the issue on my side with the project, that I have access. To solve the issue you should replace ./modules/authentication/authentication.module#AuthenticationModule
with ~/app/modules/authentication/authentication.module#AuthenticationModule
in app.routing.ts
. Keep in mind that ~/
points to src
folder.
Environment Provide version numbers for the following components (information can be retrieved by running
tns info
in your project folder or by inspecting thepackage.json
of the project):Describe the bug I am trying to perform lazy loading in the app which i am trying to build. Here is the structure of App that i have
src -----app ---------app.routing.ts ---------app.module.ts ----------modules --------------events --------------notifications --------------authentication
Here are my routes in app.routing.ts
My first Lazy loaded module AuthenticationModule gets loaded correctly. However when i try to navigate on a button click within AuthenticationModule to EventsModule via command
it gives me following error
I have enabled routetracing and get below message before getting this exception
To Reproduce Above steps should be able to reproduce issue
Expected behavior
Lazy loading should work fine and load EventsModule.
Sample project
Additional context Found this issue reported in multiple forums. Here are things which i have already tried