Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

HI,

 

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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. 

 

Solution:

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. 

 

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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. 

 

Solution:

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. 

 

Avatar

Level 3

Hi Vaibhavi, I am facing the same issue. Could you please explain what you mean by saying to overlay the transformer. I am not sure of what transformer you're refereeing to.

Thank you