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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 6.0.0, Release 5.5.1
    • Fix Version/s: Release 7.5.0
    • Component/s: Android, iOS
    • 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
      iPhone 6: 10.02
      Note 4: 5.0.0
      Lumia 550 10.0

    • Sprint:
      2018 Sprint 13 SDK, 2018 Sprint 14 SDK, 2018 Sprint 15 SDK, 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, iOS or Windows
      Actual result

      The above error is thrown

      Expected result

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hknoechel Hans Knöchel
                Reporter:
                eharris Ewan Harris
                Reviewer:
                Ewan Harris
                Tester:
                Samir Mohammed
              • Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code