I apologise in advance if the question has been already answered but I haven't been able to find anything relevant. I'm refactoring a fairly large AngularJS application, I'm creating components in form of AMD modules. The build process (grunt) uses requirejs plugin to load all the modules and concatenate them into a single js file including some libraries like jQuery.
Now, I was looking at the CommonJS syntax and it looks very much more clean and I was wondering if it is worth to use CommonJS modules instead of AMD. I see that the build process wouldn't be too different, basically I just need to swap requireJS with browserify.
Are there any advantages in using AMD modules over commonJS one in a workflow like mine? Can the asynchronous module loading be still considered an advantage at runtime when you're concatenating all the modules in a single js file?
Thanks.
when you're concatenating all the modules in a single js file
then no. you are right no need for AMD, doesnt make any sense actually. Also read requirejs.org/docs/commonjs.html – vinayakj