Description
*This is not a regression occurs using 5.5.1.GA stack*
When using
__filename
in an app.js file the following is thrown
*Using __filename 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: __filename",
[ERROR] : "native_stack": [
[ERROR] : "JSExportClass<class Titanium::GlobalObject>::CallNamedFunction"
[ERROR] : ]
[ERROR] : }
Steps to reproduce
In your app.js add console.log(__filename)
Build for Android, iOS or Windows
Actual result
The above error is thrown
Expected result
__filename should be able to be used in app.js file
Fixed for Windows: https://github.com/appcelerator/titanium_mobile_windows/pull/903
On iOS, the
__filename
property is injected inside the CommonJS scope. Example: app.jstest.js:
This will work. It won't work on the app.js. [~cwilliams] Is this an intended behavior?
Moving to post 6.1.0.
PR: https://github.com/appcelerator/titanium_mobile/pull/10247
*Closing ticket.* Verified fix in SDK version:
7.4.0.v20180810061237
. Application no longer crashes when using(__filename)
or(__dirname)
. *FR Passed (Test Steps):*Created a new application using Titanium
Added the following in to the
app.js
Ran the program
Application no longer showed an error and the following could be seen in the console
*Test Environment*
*Edit* SDK Version: {[7.4.0.v20180813131247}} was used.