The new ES6 module syntax is very nice, but not yet supported by browsers. I'd like to use the new syntax while I'm developing, then compile the modules into one JS file which can run in browsers. I haven't found any program that can do this.

I know that Babel or similar ES6-transpilers can convert import/export to require(), and eg. Browserify allows to use it in browsers, but I don't want to load multiple JS files at runtime. One compiler could convert all ES6 modules into one JS file, just like how we create one binary executable from multiple .c / .h files.

1 Answer 1


I think you are confusing some bits here.

  • Babel.js is a compiler to translate your JS code written using future features not yet supported by JS engines into ES5+ code (depending on the preset you configure here).

  • Browserify it's a bundler that takes a bunch of JS files/modules and bundle them into one (or more) JS file(s).

If you want to write your own software/app in ES6+ Javascript and bundle it into a single ES5+ Javascript file you need to setup a compiler (like Babel.js ) and a bundler (like Browserify, Webpack or Rollup ). The build chain is usually the following:

Your code --> Babel compiler --> Bundler --> Your code in ES5+

If you google Babel Browserify boilerplate or Babel Webpack boilerplate you're likely to find pre-cooked projects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.