Authoring and publishing ES6 modules today


npm publish es6-module


<script src="es6-module.js">

Writing an application in ES6

Easy, you own the environment

Writing a reusable module in ES6

Challenging, many environments

loaders and  transforms are bad for modules

they reduce portability

Data for November 2015

es6 support is not here, yet

Target: npm users

Solution: publish ES5 transpiled source code folders

file: index.js

file: package.json


directory: dist-module/


  • npm link is broken
  • require('es6-module/file') is broken
  • JavaScript stack traces are weird

May or may not be a big deal

Target: <script> users

Solution: publish bundles



file: webpack.config.dist.babel.js


directory: dist/


We can't publish ES6 modules directly.

To author ES6 modules today,
publish ES5 transpiled source code in npm.

Push ES5 bundles to any cdn for <script> users.



Real world published ES6 module

Authoring and publishing ES6 modules today

By Vincent Voyer

Authoring and publishing ES6 modules today

You want to do some ES 2015 before its 2016 but you are afraid: will this run on the many existing JavaScript environments? What about node.js, 0.10 0.12 4 5, browsers like IE 11, module loaders, script users.. How do you write and release reusable Modules using a syntax that is not yet implemented everywhere? We'll see how

  • 4,831