Answer the question
In order to leave comments, you need to log in
AMD or CommonJS?
I use React in my project. React usually uses ES6 or CommonJS modules and npm. I have bower, AMD. Accordingly, it is difficult for me to look for plugins that I can generally connect for myself. BUT. When loading my SPA, I have a minimum number of applications loaded. Even the registration form is loaded when the button is clicked, so that the user gets the loaded page very quickly and does not have to wait. As far as I know, CommonJS is usually collected in one file, and if there are several, then they all need to be included immediately in html. With AMD, I just don't pack anything, I minify everything to achieve my result.
Tell me, am I doing everything right? How can I solve my problem differently? The application is large, there will be a lot of static code.
Thank you all in advance for your kindness.
Answer the question
In order to leave comments, you need to log in
Maxim @maxfarseer
and if you use require.ensure (from the world of webpack) - will this not solve your problem? more details here - https://www.youtube.com/watch?v=Om6yGdU_YlQ
CommonJS is synchronous and not suitable for the browser because of this (so you need to either build everything in advance or manually include synchronous scripts in the correct order on the page), so only AMD.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question