C
C
candybooberr2016-07-26 00:24:22
JavaScript
candybooberr, 2016-07-26 00:24:22

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

3 answer(s)
C
candybooberr, 2016-07-26
@candybooberr

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

N
Nazar Mokrinsky, 2016-07-26
@nazarpc

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.

M
Maxim, 2016-07-26
@maxfarseer

and if you use require.ensure (from webpack world) - won't that solve your problem? more details here - https://www.youtube.com/watch?v=Om6yGdU_YlQ

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question