CommonJS / RequireJS — why?

Hi. Can someone please explain stupid, what is the difference common.js and require.js and what do we need? Plus the situations in which such tools have to be fit and why do we need all these dependency injection? A lot of different information on the Internet, can't come to a consensus. Im frustrated... Thanks
July 2nd 19 at 17:10
3 answers
July 2nd 19 at 17:12
Solution
Plus the situations in which such tools have to be fit and why do we need all these dependency injection?


Inversion of control. Manage dependencies, reducing the coupling between components of the system. That would be something that should depend on depend on something and Vice versa.

Do not think that there are universal approaches. There are different approaches, each of which has its pros and cons.
July 2nd 19 at 17:14
I do not presume to give an answer, it is not quite clear, but after meeting with nodejs, where the require is used to load the modules, I begin to suspect that it was taken up in the client part for a uniform approach. And in fact, require on the client is not so necessary.
July 2nd 19 at 17:16
These tools are necessary for several things:
1. Create a modular structure
2. Lazy loading
3. Systematization and increase control over project dependencies

All this is not necessary on small projects. But without this it is difficult is large.
Explain based on the example, do not quite understand. Type scope dependent module taken from the module on which it depends? - Shaniya commented on July 2nd 19 at 17:19

Find more questions by tags Web DevelopmentDesigning softwareJavaScript