What is the difference between ltng:require and aura:clientLibrary?

What are the best practices with regard to their usage?

What are the technical concerns that should be taken into account when choosing either of them.

I see that combine on aura:clientLibrary allows to can improve performance by reducing the number of requests

2 Answers 2


ltng:require is used to refer javascripts and CSS only from static resource and we can decide sequence in which javascript should be loaded.

Whereas aura:clientLibrary allows external Javascript even from URL as well as CSS files.

  • ltng:require totally can handle CSS, but the point is correct that require must load from a static resource. Commented Jun 23, 2015 at 2:44

Use ltng:require instead of aura:clientLibrary.

Per the doc: The framework’s content security policy mandates that external JavaScript libraries must be uploaded to Salesforce static resources. See https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_libs_platform.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .