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

Alloy: iOS - Using require() without "/" prefix will try to load file relatively node_modules first, other unrelated logs and behavior changes

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: Release 6.0.0, Release 6.0.1
    • Fix Version/s: Release 6.1.0
    • Component/s: iOS
    • Environment:

      Using TiSDK 6.0.1 or the latest 6.1 nightly. Tried CLI 6.0 and 6.1

      Description

      We're using a lot of requires in the app. Also with databinding we use require for every row. This used to work great with 5.# but now it seems to try something else. It tries to load the node_module first, then tries to find the controller/lib file resulting in a log like this:

      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location, Resource: node_modules/libs/Location
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location.js, Resource: node_modules/libs/Location_js
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location.json, Resource: node_modules/libs/Location_json
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/package.json, Resource: node_modules/libs/Location/package_json
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/index.js, Resource: node_modules/libs/Location/index_js
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/index.json, Resource: node_modules/libs/Location/index_json
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location, Resource: node_modules/libs/Location
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location.js, Resource: node_modules/libs/Location_js
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location.json, Resource: node_modules/libs/Location_json
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/package.json, Resource: node_modules/libs/Location/package_json
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/index.js, Resource: node_modules/libs/Location/index_js
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/node_modules/libs/Location/index.json, Resource: node_modules/libs/Location/index_json
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/libs/Location, Resource: libs/Location
      [DEBUG] :  Loading: /Users/renepot/Library/Developer/CoreSimulator/Devices/58DEF941-13A4-4852-A765-F23042B1F82B/data/Containers/Bundle/Application/34E19F4B-9A68-48FC-BA03-2A5B02D168BE/Roamler.app/libs/Location.js, Resource: libs/Location_js
      

      This happens for every require.

      require('libs/location.js');

      Is how it was implemented. This solves the node_modules problem in the log

      require('/libs/location.js');

      sidenote: we have a libs folder in our lib folder, it is not a typo

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fmiao Feon Sua Xin Miao
                Reporter:
                topener Rene Pot
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration