What is the difference between browserify/requirejs modules and ES6 modules

JavascriptModuleRequirejsBrowserifyEcmascript 6

Javascript Problem Overview


I'm still new to ES6 and module loaders and I'm currently looking at combining a browserify setup with ES6. I was wondering if I would still need browserify/requirejs if I'm using ES6 modules. Seems like both allow you to define modules and export them? What is the difference between browserify/requirejs modules and ES6 modules?

Javascript Solutions


Solution 1 - Javascript

After playing around for a while I did get a better understanding of things, also thanks to @Andy for the blog by Addy Osmani.

There are different module systems: AMD (RequireJS), CommonJS (Node) and the new ES6 module syntax (and the old ES5 Global system of course).

However if you want to use those in your browser you still need to load and wire those modules with some module loader library because browsers still do not support that. For that you could use a module loader like RequireJS, Browserify, SystemJS or es6-module-loader.

SystemJS is my personal favorite because it allows you to load any module system (AMD, CommonJS, ES6) and even use them interchangably in 1 app.

Update: In the mean time Webpack has become available and should be considered as a module loader as well.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjoeridegView Question on Stackoverflow
Solution 1 - JavascriptjoeridegView Answer on Stackoverflow