Can anyone explain me what is the use of shims dependencies in requirejs-config file? Doing much of research but I hasn't found exact answer for this.

  • please update requirejs-config file Commented Mar 6, 2019 at 10:51

1 Answer 1


As per my understanding,
basically shim is used to avoid dependency conflict. For example if you calling a custom javascript then it must be loaded after javascript library isn't it? but magento doesn't know whether the library is loaded or not. So using shim we'll let system know that it is dependent on library so it will be instantiated when we map shim.


Magento uses requirejs to speed up the stuffs and (asynchronously module dependencies) nature of require js. So we use shim to tell the machine load our defined dependency first i.e., jquery

If we don't define then we get jquery not defined error while developing custom extensions as well.

Alan Strom :

The RequireJS shim configuration directive allows you to configure what I’ll call “load order” dependencies. i.e., you can say

when you load the jquery.cookie module? Make sure you’ve completely loaded the jquery module first.

Example :

var config = {

We’ve defined a new top level configuration property named shim. This property is a javascript object of key value pairs. The key should be the name of your module (jquery.cookie above). The value is another javascript object that defines the shim configuration for this specific module.

see this for more information

Hope it helps :)

Your Answer

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

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