Clientlibs load Issue when Experience Fragment is Exported to target and added on AEM page through Target.





We are facing a issue where same client library is getting loaded twice on the page through the content Added from Target on the page. This leads to breaking of few functionalities on the page. Below I have explained the scenario in details. 


AEM page has one client library. (/etc.clientlibs/mysite/component.js)
One component is authored inside Experience fragment and that is exported to target. Same is included on a page as a Target offer.
That component also has same clientlibrary inclusion. (/etc.clientlibs/mysite/component.js)
When the Target offer is added on the page same client libraries gets loaded twice on the page. First One directly from AEM page itself and second one through target. 

In normal use case if same client library is included twice as part of 2 different components on AEM page then it gets included only once. Same doesn't happen in the use case mentioned above.


Has anyone faced similar issues? Can you please guide me how to deal with this issue.

Accepted Solutions (1)

Accepted Solutions (1)




Hi Amit, 

I did faced similar issue. It is due to the experience fragments are exported with client library to target. This will be valid use case when AEM template is not loaded with component specific client library or offers are used in non AEM pages. 



You can overlay the trasformer and restrict the client library from exporting into target where only html will be exported which resolves the issue. 

This worked for me. 


Answers (0)