+ Start a Discussion
yogaraj kvyogaraj kv 

Load External JS With Lightning locker Service enabled

Hello,
I have created an lightning application using Bootstrap,JQuery js. its working fine without lightning locker service enabled. It's not working with Lightning locker service enabled. I  did some analysis on the chrome debugger tool. 
Without Lightning locker service,
The JS resource loaded under the domain name refer image1
User-added image
With Lightning locker service,
The JS resource loaded under the file:// folder refer image2 [its trying to refer from local]. Am getting error like 'Cannot read property'expando' of undefined throws at/resource/DesignWR/jquery.js:5:4569'
User-added image
<ltng:require scripts="/resource/DesignWR/js/jquery.js,    
                           /resource/DesignWR/js/bootstrap.min.js"
                  styles="/resource/DesignWR/css/bootstrap.css,
                          /resource/DesignWR/css/bootstrap.icon-large.min.css"
                  afterScriptsLoaded="{!c.disableFocus}"/>
Kindly help me to resolve this issue



 
SandhyaSandhya (Salesforce Developers) 
Hi Yogaraj,

There is a code linting tool to validate your code.Please refer below links for the same thought it could help you.

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/cli_intro.htm

http://salesforce.stackexchange.com/questions/133841/issue-with-loading-using-external-javascript-static-resource-in-lightning-compon
  
Hope this helps you!

Please mark it as solved if this helps you so that it will make for others as a proper solution.

Thanks and Regards
Sandhya
yogaraj kvyogaraj kv
Hi Sandhya,

Thanks. I have rectified the errors which shown during CLI validation. But CLI throwing $A.util.isUndefined()/$A.util.isUndefinedOrNull() function as error. 
The heroku lightning plugin version used,
 D:\WS\Lightning>heroku --version
heroku/toolbelt/3.43.9 (i386-mingw32) ruby/2.1.7
heroku-cli/5.2.34-65b16c9 (windows-386) go1.6.2
=== Installed Plugins
salesforce-lightning-cli@1.1.0

Still am facing the same issue.
Thanks
SandhyaSandhya (Salesforce Developers) 
Hi,

Not sure about that, Is that error? I see that as a method in below link.

https://developer.salesforce.com/blogs/developer-relations/2015/04/lightning-components-javascript-api.html
 

Thanks
Sandhya
yogaraj kvyogaraj kv
  error  aura-api  Invalid Aura API 
  Line:168:14
          if (!$A.util.isUndefined(analystObj))
               ^
✖ 1 problem (1 error, 0 warnings)




 
SandhyaSandhya (Salesforce Developers) 
Sorry not able to resolve try to put this thread in success community you may get answer from there.

https://success.salesforce.com/