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

Android: Hybrid CommonJS and Native Modules don't export the commonjs code

    Details

    • Story Points:
      8

      Description

      When I create a pure Javascript Module, any exported method is accessible.

      In detail for the module I've:

      1. Created a new Mobile Module Project, from Appcelerator Studio, with id (for example) it.module.test
      2. Inside assets folder, I've created a js file called it.module.test.js
      3. Into it.module.test.js I have:

        module.exports = { 
           something: "hi" 
        }
        

      Now I package this module directly from Appcelerator Studio and install this module inside a Test Application.

      Into this application I do:

      var module = require("it.module.test");
      Ti.API.info(module.something);
      

      And the result is null.

      The problem is that the native module classes are being called instead of the CommonJS ones as per the docs.

      _UPDATE_

      After several tests, it seems that the problem is the Titanium SDK 4.0.0.
      When I create the module project inside Appcelerator Studio and selecting a previous version of Titanium SDK (3.4.1 for example) all works perfectly with the same code.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cwilliams Christopher Williams
                Reporter:
                Andrea.Vitale Andrea Vitale
                Reviewer:
                Hans Knöchel
                Tester:
                Abir Mukherjee
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code