maximally minimal modules for a hypothetical es6

npm install mmmify
3 downloads in the last week
12 downloads in the last month


maximally minimal modules that are ACTUALLY minimal

This is a proof of concept for what ES6 should be doing for modules, instead of what they are actually doing which is so terrible you have no idea.

ES6 modules are some namespacey thing that doesn't care about the right things to make modularity really work. This proposal is by no means perfect but it would be so much better.

build status


Use import PATH to load a module from the string PATH. import is a keyword like typeof that just returns an ordinary value.

Use export VALUE to export functionality. Think of it like return that doesn't immediately jump out of the current context.


// main.js

var foo = import './foo.js'
// foo.js

var bar = import './bar.js'
export function (n) { return bar(n) * 10 };
// bar.js

export function (n) { return n + 3 };

build it with browserify:

$ browserify -t mmmify main.js > bundle.js

then run it with node (or a browser):

$ node bundle.js



var mmmify = require('mmmify')

This module is a browserify transform but you don't need to use browserify necessarily to use it.


Return a through-stream desugaring import and export keywords into require() and module.exports=... that can be parsed by node and browserify.

see also

This module syntax proposal is really similar to isaac's great es6 modules proposal.

Check out domenic's gist on node<->es6 interop while you're at it.


Right now import and export just desugar to require() and module.exports but in the future they could be made to do something slightly more robust and static analysis-y. The point of this proof of concept module is to demonstrate how excellent and simple ES6 modules could possibly be.


With npm do:

npm install mmmify



npm loves you