Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26286] Android: Using __dirname in app.js errors with Can't find variable: __dirname

GitHub Issuen/a
TypeBug
PriorityHigh
StatusResolved
ResolutionDuplicate
Resolution Date2018-08-12T07:46:00.000+0000
Affected Version/sRelease 6.0.0, Release 5.5.1
Fix Version/sn/a
ComponentsAndroid
Labelsqe-6.0.0
ReporterEwan Harris
AssigneeHans Knöchel
Created2018-08-10T13:05:58.000+0000
Updated2018-08-12T07:46:44.000+0000

Description

Description

*This is not a regression occurs using 5.5.1.GA stack* When using __dirname in an app.js file the following is thrown *Using __dirname in any file other than app.js works*
[ERROR] :  Application Error: {
[ERROR] :    "line": 2,
[ERROR] :    "column": 10,
[ERROR] :    "message": "require: Error while require(/app) Can't find variable: __dirname",
[ERROR] :    "native_stack": [
[ERROR] :      "JSExportClass<class Titanium::GlobalObject>::CallNamedFunction"
[ERROR] :    ]
[ERROR] :  }

Steps to reproduce

In your app.js add console.log(__dirname)

Build for Android

Actual result

The above error is thrown

Expected result

__dirname should be able to be used in app.js file

Comments

  1. Hans Knöchel 2018-08-12

    PR: https://github.com/appcelerator/titanium_mobile/pull/10247 Test-case can be seen via the original iOS ticket.

JSON Source