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

Allow require to find modules in node_modules, etc


    • Type: New Feature
    • Status: Closed
    • Priority: High
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Tooling
    • Labels:


      As a developer,
      I want to be able to use NPM to install modules and libraries,
      So that I can install packages such as bluebird, lodash, or custom libraries from NPM in my application.

      Unless I am missing something here, at compile time, you know all the libraries that could possibly be referenced. For all static includes, i.e. require("lodash") or require("../mylib"), you could easily map and change the requires to the correct path before packaging the app.

      Dynamic requires, i.e. require(myvar + "mylib") would require a bit more effort such as creating a function that could lookup the desired library at runtime and use that with the relative folder to find it in a list of libraries in the app (assuming the list was generated at compile time.)

      You could also look in the package.json files at compile time to see if there is a main referenced. Support for index.js could also be added at compile time.

      I've tried a few of the methods such as ti-commonjs which look for things at runtime, but the performance hit from those was far too great.


          Issue Links



              • Assignee:
                cwilliams Christopher Williams
                brentonhouse Brenton House
              • Watchers:
                5 Start watching this issue


                • Created:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration