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

iOS: device builds don't use platform-specific files for commonjs modules

    Details

      Description

      problem

      When referencing commonjs modules in code, iOS device builds do not reference platform specific modules if they are present, instead they reference the non-platform-specific ones. This does not occur on iOS simulator builds, which behave as expected. This makes it impossible to use platform-specific versions of Javascript files on iOS device builds, being a blocker for the linked tickets.

      test case

      app.js

      var win = Ti.UI.createWindow({
      	backgroundColor: '#fff',
      	modal: false,
      	exitOnClose: true
      });
       
      win.open();
       
      require('lib/mylib').sayHello();
      

      lib/mylib.js

      exports.sayHello = function() {
      	alert('hello from the CFG.js (you should never see this)');
      }
      

      iphone/lib/mylib.js

      exports.sayHello = function() {
      	alert('hello from the iphone CFG.js');
      }
      

      reproduce

      1. Create a traditional titanium app, adding the files mentioned above.
      2. Run for iOS simulator
      3. Confirm that you get the message from the platform-specific mylib.js file: "hello from the iphone CFG.js"
      4. Now run for an iOS device
      5. You will get the error described here, where the non-platform-specific module is referenced, giving you the message: "hello from the CFG.js (you should never see this)"

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cbarber Chris Barber
                Reporter:
                tlukasavage Tony Lukasavage
              • Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • It looks like Backbone Issue Sync is not enabled for your project.

                    Git Source Code