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

24,699

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.

Share:
24,699
joerideg
Author by

joerideg

Updated on July 05, 2022

Comments

  • joerideg
    joerideg almost 2 years

    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?

  • Alexander Mills
    Alexander Mills over 8 years
    even though I prefer RequireJS, don't forget about Webpack. Like SystemJS, Webpack is also agnostic about whether to use AMD, CommonJS or ES6 as a module system.
  • Dan Dascalescu
    Dan Dascalescu over 7 years