what is requirejs-config.js in Magento2?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
2
down vote

favorite












Can any one tell that what is the difference between the keywords that are used in requirejs-config.js like 'map','paths','shim' and 'deps' please elaborate exact difference if possible with example?



var config = 
"map":
'*':


,
"deps": [

],
"shim":
,
"paths":
,
;









share|improve this question























  • For getting more information about require js & require config js concepts you have to try this alanstorm.com/magento_2_and_requirejs blog written by Alan. Thanks.
    – Raj
    10 mins ago
















up vote
2
down vote

favorite












Can any one tell that what is the difference between the keywords that are used in requirejs-config.js like 'map','paths','shim' and 'deps' please elaborate exact difference if possible with example?



var config = 
"map":
'*':


,
"deps": [

],
"shim":
,
"paths":
,
;









share|improve this question























  • For getting more information about require js & require config js concepts you have to try this alanstorm.com/magento_2_and_requirejs blog written by Alan. Thanks.
    – Raj
    10 mins ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











Can any one tell that what is the difference between the keywords that are used in requirejs-config.js like 'map','paths','shim' and 'deps' please elaborate exact difference if possible with example?



var config = 
"map":
'*':


,
"deps": [

],
"shim":
,
"paths":
,
;









share|improve this question















Can any one tell that what is the difference between the keywords that are used in requirejs-config.js like 'map','paths','shim' and 'deps' please elaborate exact difference if possible with example?



var config = 
"map":
'*':


,
"deps": [

],
"shim":
,
"paths":
,
;






magento2 requirejs-config.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago

























asked 1 hour ago









Charul Tyagi

45811




45811











  • For getting more information about require js & require config js concepts you have to try this alanstorm.com/magento_2_and_requirejs blog written by Alan. Thanks.
    – Raj
    10 mins ago
















  • For getting more information about require js & require config js concepts you have to try this alanstorm.com/magento_2_and_requirejs blog written by Alan. Thanks.
    – Raj
    10 mins ago















For getting more information about require js & require config js concepts you have to try this alanstorm.com/magento_2_and_requirejs blog written by Alan. Thanks.
– Raj
10 mins ago




For getting more information about require js & require config js concepts you have to try this alanstorm.com/magento_2_and_requirejs blog written by Alan. Thanks.
– Raj
10 mins ago










2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










Shim:



To build a dependency on the third-party plugin, specify a [shim] in the following configuration files:



requirejs-config.js



 var config = 
"shim":
"3-rd-party-plugin": ["jquery"]

;


Map:



Replace a default JS component
To use a custom implementation of an existing Magento JS component: Place the custom component source file in one of the following locations:



Your theme JS files: /web/js or /_/web/js
Your module view JS files: /view/frontend/web/js
Create a RequireJS configuration file requirejs-config.js, having specified the following:



var config = 
"map":
"*":
"<default_component>": "<custom_component>"


;


Deps:



Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.
example:



var config = 
"deps": [
"jquery"
]
;


Here, It loads the [jquery] as soon as the require define()’d is called.






share|improve this answer



























    up vote
    1
    down vote













    map: map is used to provide a prefix to a module with the different Id.
    format of map configuration:



    map: 
    '<module name>':
    '<Id>': '<JS file>'




    deps: Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.



    var config = 
    "map":
    '*':
    'sample': 'sample1.js'

    ,
    "deps": [
    "jquery"
    ]
    ;


    shim: It used when there are some scripts, to whome you want to declare globally, and those scripts not using define() to define values, if those scripts already used the define() then it will not work correctly.
    examples:



    var config = 
    "shim":
    "sample":
    "deps": ["jquery"],
    "exports": webkulSample





    For more details refer this link - https://webkul.com/blog/require-js-configurations/



    Hope it helps !






    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "479"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f243416%2fwhat-is-requirejs-config-js-in-magento2%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote



      accepted










      Shim:



      To build a dependency on the third-party plugin, specify a [shim] in the following configuration files:



      requirejs-config.js



       var config = 
      "shim":
      "3-rd-party-plugin": ["jquery"]

      ;


      Map:



      Replace a default JS component
      To use a custom implementation of an existing Magento JS component: Place the custom component source file in one of the following locations:



      Your theme JS files: /web/js or /_/web/js
      Your module view JS files: /view/frontend/web/js
      Create a RequireJS configuration file requirejs-config.js, having specified the following:



      var config = 
      "map":
      "*":
      "<default_component>": "<custom_component>"


      ;


      Deps:



      Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.
      example:



      var config = 
      "deps": [
      "jquery"
      ]
      ;


      Here, It loads the [jquery] as soon as the require define()’d is called.






      share|improve this answer
























        up vote
        1
        down vote



        accepted










        Shim:



        To build a dependency on the third-party plugin, specify a [shim] in the following configuration files:



        requirejs-config.js



         var config = 
        "shim":
        "3-rd-party-plugin": ["jquery"]

        ;


        Map:



        Replace a default JS component
        To use a custom implementation of an existing Magento JS component: Place the custom component source file in one of the following locations:



        Your theme JS files: /web/js or /_/web/js
        Your module view JS files: /view/frontend/web/js
        Create a RequireJS configuration file requirejs-config.js, having specified the following:



        var config = 
        "map":
        "*":
        "<default_component>": "<custom_component>"


        ;


        Deps:



        Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.
        example:



        var config = 
        "deps": [
        "jquery"
        ]
        ;


        Here, It loads the [jquery] as soon as the require define()’d is called.






        share|improve this answer






















          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Shim:



          To build a dependency on the third-party plugin, specify a [shim] in the following configuration files:



          requirejs-config.js



           var config = 
          "shim":
          "3-rd-party-plugin": ["jquery"]

          ;


          Map:



          Replace a default JS component
          To use a custom implementation of an existing Magento JS component: Place the custom component source file in one of the following locations:



          Your theme JS files: /web/js or /_/web/js
          Your module view JS files: /view/frontend/web/js
          Create a RequireJS configuration file requirejs-config.js, having specified the following:



          var config = 
          "map":
          "*":
          "<default_component>": "<custom_component>"


          ;


          Deps:



          Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.
          example:



          var config = 
          "deps": [
          "jquery"
          ]
          ;


          Here, It loads the [jquery] as soon as the require define()’d is called.






          share|improve this answer












          Shim:



          To build a dependency on the third-party plugin, specify a [shim] in the following configuration files:



          requirejs-config.js



           var config = 
          "shim":
          "3-rd-party-plugin": ["jquery"]

          ;


          Map:



          Replace a default JS component
          To use a custom implementation of an existing Magento JS component: Place the custom component source file in one of the following locations:



          Your theme JS files: /web/js or /_/web/js
          Your module view JS files: /view/frontend/web/js
          Create a RequireJS configuration file requirejs-config.js, having specified the following:



          var config = 
          "map":
          "*":
          "<default_component>": "<custom_component>"


          ;


          Deps:



          Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.
          example:



          var config = 
          "deps": [
          "jquery"
          ]
          ;


          Here, It loads the [jquery] as soon as the require define()’d is called.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 46 mins ago









          Ansar Husain

          1,408217




          1,408217






















              up vote
              1
              down vote













              map: map is used to provide a prefix to a module with the different Id.
              format of map configuration:



              map: 
              '<module name>':
              '<Id>': '<JS file>'




              deps: Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.



              var config = 
              "map":
              '*':
              'sample': 'sample1.js'

              ,
              "deps": [
              "jquery"
              ]
              ;


              shim: It used when there are some scripts, to whome you want to declare globally, and those scripts not using define() to define values, if those scripts already used the define() then it will not work correctly.
              examples:



              var config = 
              "shim":
              "sample":
              "deps": ["jquery"],
              "exports": webkulSample





              For more details refer this link - https://webkul.com/blog/require-js-configurations/



              Hope it helps !






              share|improve this answer
























                up vote
                1
                down vote













                map: map is used to provide a prefix to a module with the different Id.
                format of map configuration:



                map: 
                '<module name>':
                '<Id>': '<JS file>'




                deps: Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.



                var config = 
                "map":
                '*':
                'sample': 'sample1.js'

                ,
                "deps": [
                "jquery"
                ]
                ;


                shim: It used when there are some scripts, to whome you want to declare globally, and those scripts not using define() to define values, if those scripts already used the define() then it will not work correctly.
                examples:



                var config = 
                "shim":
                "sample":
                "deps": ["jquery"],
                "exports": webkulSample





                For more details refer this link - https://webkul.com/blog/require-js-configurations/



                Hope it helps !






                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  map: map is used to provide a prefix to a module with the different Id.
                  format of map configuration:



                  map: 
                  '<module name>':
                  '<Id>': '<JS file>'




                  deps: Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.



                  var config = 
                  "map":
                  '*':
                  'sample': 'sample1.js'

                  ,
                  "deps": [
                  "jquery"
                  ]
                  ;


                  shim: It used when there are some scripts, to whome you want to declare globally, and those scripts not using define() to define values, if those scripts already used the define() then it will not work correctly.
                  examples:



                  var config = 
                  "shim":
                  "sample":
                  "deps": ["jquery"],
                  "exports": webkulSample





                  For more details refer this link - https://webkul.com/blog/require-js-configurations/



                  Hope it helps !






                  share|improve this answer












                  map: map is used to provide a prefix to a module with the different Id.
                  format of map configuration:



                  map: 
                  '<module name>':
                  '<Id>': '<JS file>'




                  deps: Is used when your require js configurations depends upon some dependencies, i.e. you want to load some dependencies before your requires js define()’d is called.



                  var config = 
                  "map":
                  '*':
                  'sample': 'sample1.js'

                  ,
                  "deps": [
                  "jquery"
                  ]
                  ;


                  shim: It used when there are some scripts, to whome you want to declare globally, and those scripts not using define() to define values, if those scripts already used the define() then it will not work correctly.
                  examples:



                  var config = 
                  "shim":
                  "sample":
                  "deps": ["jquery"],
                  "exports": webkulSample





                  For more details refer this link - https://webkul.com/blog/require-js-configurations/



                  Hope it helps !







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 58 mins ago









                  Manthan Dave

                  7,40421336




                  7,40421336



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f243416%2fwhat-is-requirejs-config-js-in-magento2%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      What does second last employer means? [closed]

                      Installing NextGIS Connect into QGIS 3?

                      One-line joke