Skip to content

Modules that have names ending in .page are not found #7646

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

Closed
surdu opened this issue Aug 3, 2019 · 5 comments · Fixed by #7655
Closed

Modules that have names ending in .page are not found #7646

surdu opened this issue Aug 3, 2019 · 5 comments · Fixed by #7655
Labels

Comments

@surdu
Copy link
Contributor

surdu commented Aug 3, 2019

Describe the bug
If a module name ends in .page (I'm guessing .<anything>) you'll not be able to use it, at least not as a Frame's defaultPage.

Please see this Playground example.

To Reproduce
Run the Playground example.

Expected behavior
The app starts without crash, showing the home/home.page page.

Additional context
I have a {N} 5.0 project and I preferred the .page suffix instead of the -page suffix for my pages.

@NickIliev NickIliev transferred this issue from NativeScript/NativeScript Aug 5, 2019
@rosen-vladimirov
Copy link
Contributor

@surdu ,
Thanks for the report. The files are correctly included in the bundle.js during build, but it fails at runtime when trying to construct the UI with error:

System.err: An uncaught Exception occurred on “main” thread.
System.err: Unable to start activity ComponentInfo{org.nativescript.appPage1/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Building UI from XML. @app-root.xml:1:1
System.err:  > Failed to load component from module: main
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.appPage1/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: Error: Building UI from XML. @app-root.xml:1:1
System.err:  > Failed to load component from module: main
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     at android.os.Looper.loop(Looper.java:193)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:6669)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
System.err: Caused by: com.tns.NativeScriptException: Calling js method onCreate failed

As this seems an issue in the tns-core-modules I'm moving this issue in the NativeScript repository.

@rosen-vladimirov rosen-vladimirov transferred this issue from NativeScript/nativescript-cli Aug 6, 2019
@vakrilov
Copy link
Contributor

vakrilov commented Aug 6, 2019

Confirmed. The sanitizeModuleName method removes the part after the last dot. So main.page is "sanitized" to main.

Probably the best approach will be to have a list of known extensions and remove the part after the dot only if it matches any of the known extensions.

@surdu
Copy link
Contributor Author

surdu commented Aug 7, 2019

That looks pretty straight forward to fix. I could give it a try if nobody already started working on it.

@surdu
Copy link
Contributor Author

surdu commented Aug 7, 2019

Fixed it 😃

@surdu
Copy link
Contributor Author

surdu commented Oct 1, 2019

@vakrilov Was this not published yet? I recall testing the published version 6 and this was working. Now it's not working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants