Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-26286

Android: Using __dirname in app.js errors with Can't find variable: __dirname

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: High
    • Resolution: Duplicate
    • Affects Version/s: Release 6.0.0, Release 5.5.1
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:

      OS: Microsoft Windows 10 Pro 10.0.14393
      Appc core: 6.0.0-56
      Appc NPM: 4.2.8-7
      Ti SDK: 6.0.0.v20161006013211
      Appc Studio: 4.8.0.201610060953
      Note 4: 5.0.0
      Lumia 550 10.0

    • Story Points:
      0
    • Sprint:
      2018 Sprint 16 SDK

      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
      1. In your app.js add console.log(__dirname)
      2. Build for Android
      Actual result

      The above error is thrown

      Expected result

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

        Attachments

          Activity

            People

            • Assignee:
              hknoechel Hans Knöchel
              Reporter:
              eharris Ewan Harris
              Reviewer:
              Gary Mathews
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-6516
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration