Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

HTL Javascript API Dependencies not working

Ganesh_Pathak
Level 2
Level 2

Hi,

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

1753178_pastedImage_1.png

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

1753182_pastedImage_3.png

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

1 Accepted Solution
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

Hi,

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

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

View solution in original post

2 Replies
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

Hi,

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

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

View solution in original post