Skip to content

Logs from platform specific files point to incorrect file #5252

Closed
@rosen-vladimirov

Description

@rosen-vladimirov

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.4.0
  • Cross-platform modules: Not applicable
  • Android Runtime: Not applicable
  • iOS Runtime: Not applicable
  • Plugin(s): Not applicable

Describe the bug
CLI parses device logs and replaces the file path locations in them with local paths to the project. However, in case the filepath is from platform specific file, the path in the logs points to a non-existent file instead of the platform specific one.

To Reproduce

tns create myApp --js
cd myApp
mv app/main-page.js app/main-page.ios.js
# edit app/main-page.ios.js and add `console.trace("MAIN PAGE"); in the `onNavigatingTo` method.
tns run ios

Check the logs:

CONSOLE TRACE file:///app/main-page.js:21:0: MAIN PAGE
onNavigatingTo(file:///app/main-page.js:21:0)

However, we do not have such file, it should point to main-page.ios.js file.

Another way to reproduce the issue

tns create myApp --js
cd myApp
# edit main-view-model.js and in the onTap handler add throw new Error("some error");
tns run ios

Check the logs and the callstack - the callstack contains some lines about button:

file:///node_modules/@nativescript/core/ui/button/button.js:216:0

However, there's no button.js at this location, it should be button.ios.js

Expected behavior
File paths should be correct.

Sample project

Additional context
The issue is not reproducible with Angular project.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions