function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeremy Benetz 8Jeremy Benetz 8 

I am having intermittent issues loading a static javascript resource using lightning:require.

I am using the Lodash and Moment javascript libraries, imported as static resources, in several lighting components. Most of the time they work great, but every so often I get an error like this in the UI: 

Action failed: ltng:require$controller$init [ltng:require encountered an existing <script> element for /resource/SDS_LODASH_JS that was not created by an ltng:require instance. Unable to determine when the script would complete loading!]

I'm currently loading these libraries with the following tag: 
<ltng:require scripts="{!join(',',
                          $Resource.SDS_Moment_JS,
                          $Resource.SDS_LODASH_JS)}"
                  afterScriptsLoaded="{!c.doInit}"/>

Has anyone else had this problem and figured out how to resolve it?
 
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Jeremy,

May I suggest you please refer the below link for reference. hope it helps.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar
Jeremy Benetz 8Jeremy Benetz 8
Thanks Rahul but neither of those links are helpful. Again, my scripts load successfully the majority of the time. It's only occasionally they fail with the Salesforce error message like the following:
 
Action failed: ltng:require$controller$init [ltng:require encountered an existing <script> element for /resource/SDS_LODASH_JS that was not created by an ltng:require instance. Unable to determine when the script would complete loading!]

I don't know if it's work mentioning but neither of my resources are zipped.