Please tell me why we use requirejs and require-configjs files and purpose of these two files on magento 2.Complete Details if Possible.
1 Answer
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.