I want to include yahoo.js and yahoo-calendar.min.js from my custom module

yahoo.js enter image description here

yahoo-calendar.min.js enter image description here

basically i need to call the function from yahoo-calendar.min.js which require yahoo.js file, i tried to include it like this using requirejs-config.js from my custom module:

var config = {
    "map": {
        "*": {
            YAHOO: 'Vendor_Module::js/yahoo-calendar.min' 

i'm gonna use YAHOO as the alias , but i don't know where to put the yahoo.js file

the usage will be like this:

                    YAHOO.example.calendar.init = function() {
                        YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar("cal1",'container-id');


1 Answer 1


You can add multiple js files in your requirejs-config.js file. Try like below,

var config = {
    'map': {
        '*': {
            'yahoo' : 'Vendor_Module::js/yahoo', 
            'yahoo-calendar': 'Vendor_Module::js/yahoo-calendar.min' 
    'shim': {
        'yahoo-calendar': {
            deps: ['yahoo']

Here, shim is used to create a dependency with your JS files, It will make sure that your yahoo.js file will be called before it will call yahoo-calendar.js

One more thing to note here is that you do not add .js extension in your requirejs-config.js file.

  • thanks for the answer, in my main js , should i use the alias yahoo as YAHOO or yahoo-calendar as YAHOO ?
    – jojo
    Feb 25, 2020 at 10:32
  • You can only use the file you require in your main.js, here, it is 'yahoo-calendar' Feb 25, 2020 at 10:35
  • Allow your main.js to fetch dependencies dynamically. You need to wrap you function in AMD: require() : require(['yahoo-calendar'], function ( yahooCalendar ) { // rest of your code here }); Feb 25, 2020 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.