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

LiveView: unable to require files under node_modules


    • Type: Bug
    • Status: Open
    • Priority: None
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: LiveView


      SDK: 8.0.2.GA
      Titanium: 5.2.1
      Alloy: 1.14.0-1

      UPDATE: Upon further investigation, I've found that it is more than just Alloy.Globals that is being affected by this. Every time alloy is required using `require()` it is getting a fresh version so any changes that were made to the same module in a different class are lost.

      require('/alloy') on index.js gets a clean version and thus all changes made in alloy.js are gone. Even if I move all the logic of assigning things to Alloy.Globals to index.js, everything added is gone when the next controller is loaded.

      I have a stand-alone project that I can share to duplicate this issue.

      When defining an event handler function in alloy.js:

      Alloy.Globals.eventHandler = e => {
      	console.error('you are here → Alloy.Globals.eventHandler1');
      	alert('button clicked 1');

      and then using it in index.xml:

      <Label id="label1" onClick="Alloy.Globals.eventHandler" text="Hello, World" />

      When this auto-generated controller code is executed:

      $.addListener($.__views.label1, 'click', Alloy.Globals.eventHandler);

      It gets to this code in the BaseController:

      proxy.addEventListener(type, callback);

      and then throws an error because callback is undefined.

      [INFO]  [LiveView] Error Evaluating app.js @ Line: 430
      [ERROR] Error: Invalid type passed to function
      [ERROR] File: app.js
      [ERROR] Line: 430
      [ERROR] SourceId: <null>
      [ERROR] Backtrace:
      [ERROR]  undefined

      The file is actually BaseController.js Line: 430 but it just reports app.js when using LiveView.

      NOTE: This does not happen in every app. I am not sure how LiveView is handling alloy.js code so I might need to get more familiar with that before I can say what or why Alloy.Globals.eventHandler would be undefined even though it is defined in alloy.js.


          Issue Links



              • Assignee:
                eharris Ewan Harris
                bhouse Brenton House
              • Watchers:
                6 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