Please tell me why we use requirejs and require-configjs files and purpose of these two files on magento 2.Complete Details if Possible.

enter image description here

1 Answer 1


As per the dev docs:

To address the problem of slow page load, we exclude JavaScript from the page headers and we added the ability to use the RequireJS library.

RequireJS improves the perceived page load time because it allows JavaScript to load in the background; in particular, because it enables asynchronous JavaScript loading.

It is also used to track/inject dependencies to make managing Javascript easier. If you've worked on Magento 1 you'll remember the huuuuuge JS files that were difficult to maintain.

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.