HTL Javascript API Dependencies not working | Community
Skip to main content
Level 2
May 15, 2019 8:58 AM UTC
Solved

HTL Javascript API Dependencies not working

Hi,

I am going by this AEM documentation for adding "Dependencies" in HTL Javascript file. HTL JavaScript Use-API .

This is how I am trying to access dependent js file.

When I add dependency i.e. MyUtils.js file in my javascript I get below error:

org.apache.sling.scripting.sightly.SightlyException: javax.script.ScriptException: Failure running script /apps/social/samples/components/mainmastertemplate/mainmastertemplate.js: Required script resource could not be located: ./MyUtils.js. The caller is /apps/social/samples/components/mainmastertemplate/mainmastertemplate.js

What's the correct way to access "Dependencies" in HTL js file?

Regards,

Ganesh

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
May 15, 2019 10:24 AM UTC

Hi,

Can you try with use(['MyUtils.js'], function(utils))

if doesn't work, give the complete path from /apps/.....MyUtils.js

Arun Patidar

2 replies

Level 2
May 15, 2019 11:23 AM UTC

Thank you Arun. It works now

Translate
arunpatidar
arunpatidarAccepted solution
New Participant
May 15, 2019 10:24 AM UTC

Hi,

Can you try with use(['MyUtils.js'], function(utils))

if doesn't work, give the complete path from /apps/.....MyUtils.js

Translate
Arun Patidar