Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6144] SDK 7.5.0 breaks support for external javascript libraries

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2019-03-06T22:26:46.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterPeter Ladis
AssigneeShak Hossain
Created2019-02-20T00:57:54.000+0000
Updated2019-03-06T22:26:50.000+0000

Description

I use libraries like moment.js , linq.js. In 7.4.0 I have code like this in my app.js function include(file) { return eval(Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, file).read().text); } include('ui/common/moment.js'); include('ui/common/linq.min.js'); include('ui/common/mustache.js'); And then thought my code files I can reference moment(). etc.....is there a workaround for this in 7.5.0 SDK

Comments

  1. Joshua Quick 2019-02-20

    Which platform are you having this issue on? Android? iOS? I assume iOS. Because Android didn't support File.read() of JS files for device/production builds until 7.5.0 as can be seen here [TIMOB-16678].
  2. Gary Mathews 2019-02-20

    Why not use require?
       const moment = require('./moment.js');
       console.log(moment().endOf('day').fromNow());
       
       // in 13 hours
       
  3. Sharif AbuDarda 2019-02-21

    Hello [~peterladis], Can you follow up here? did you follow Gary's guide on using require instead of include? Let us know. Thanks.
  4. Rakhi Mitro 2019-02-27

    [~peterladis], Did you manage to follow Gary's suggestion and test this on SDK 7.5.1.GA . Please update it on your end by executing *appc ti sdk install latest* and let us know the results.
  5. Rakhi Mitro 2019-03-04

    Hello, We haven't heard back from you since our last response. I am just following up to check the status of this case and if you need further help on it. 

JSON Source