es6-modules-commonjs
Compiles JavaScript written using ES6 modules to CommonJS syntax. For example, this:
module React from "react";;;
compiles to this:
var React = ;var format = "format";moduleexports"React" = React moduleexports"fmt" = format;
For more information about the proposed syntax, see the wiki page on modules.
Install
$ npm install es6-modules-commonjs
Usage
$ node> var compile = compile;
Without arguments:
> ;'var util = require("util");'
Browserify
Browserify support is built in.
$ npm install es6-modules-commonjs # install local dependency
$ browserify -t es6-modules-commonjs $file
Setup
First, install the development dependencies:
$ npm install
Then, try running the tests:
$ npm test