Skip to content


Subversion checkout URL

You can clone with
Download ZIP
RequireJS loader plugin that supports some parts of ECMAScript Harmony Modules
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A simulation of some APIs that are proposed for ECMAScript Harmony for JavaScript modules, but done as a loader plugin that works with RequireJS, and other AMD loaders that support the loader plugin API supported by RequireJS.

The APIs are taken from here:

Not all the APIs are supported, see further below for more details.


The goal is to allow using harmony-like modules today, that work in today's browsers and in Node. This allows playing with the APIs to make sure they get some use and understanding before baking them into a standard.

It is also a way for me to experiment with the API and suggest changes in a way that holds together in real code.


The loader plugin just uses some regular expressions, and it relies on existing JavaScript engines, which cannot do the fancy compilation and linking that native support can do.

This means some things that would be early errors in a native implementation are not early errors with this approach, and there are probably some parsing edge cases that fail with this approach vs. native support.

It is possible to take this code and go further with a real parser, and this code may expand for that purpose, but for now, the regexp approach allows a quicker proof of concept.

Supported APIs

TODO module math {} NOT supported

string resolution: .js and mod/name Mention .hm for the files that are harmony files. Inclusion and exclusion lists?

Something went wrong with that request. Please try again.