Browserify ES6 Module Transpiler
raw JSON → 0.1.1 verified Fri May 01 auth: no javascript deprecated
A Browserify transform that compiles ES6 module syntax (import/export) to CommonJS using the ES6 Module Transpiler. Version 0.1.1 is the latest release; no updates since 2014. This project is experimental (WIP) and superseded by Babel. Designed for early adopters of ES6 modules in Browserify builds, but now obsolete. Not recommended for new projects.
Common errors
error TransformError: .../node_modules/browserify-es6-modules/index.js: ... is not a function ↓
cause The transform is applied incorrectly (e.g., calling it as a function instead of passing a string).
fix
Use b.transform('browserify-es6-modules') not b.transform(require('...')).
error Module not found: es6-module-transpiler not installed ↓
cause Missing peer dependency es6-module-transpiler.
fix
Run: npm install es6-module-transpiler
Warnings
deprecated This package is unmaintained and superseded by Babel. Do not use in new projects. ↓
fix Use Babel with babelify transform instead.
breaking Experimental (WIP) – may not correctly transpile all ES6 module syntax. ↓
fix Test your code thoroughly or switch to a mature alternative.
gotcha Requires es6-module-transpiler to be installed separately; not listed as a dependency in package.json. ↓
fix Explicitly install es6-module-transpiler alongside this package.
Install
npm install browserify-es6-modules yarn add browserify-es6-modules pnpm add browserify-es6-modules Imports
- default export (transform function) wrong
import transform from 'browserify-es6-modules';correctmodule.exports = require('browserify-es6-modules'); - Transform usage in package.json or gulp wrong
browserify().transform(require('browserify-es6-modules'));correctbrowserify().transform('browserify-es6-modules'); - Stream interface wrong
var tr = new require('browserify-es6-modules')();correctvar through = require('through2'); var tr = through();
Quickstart
// Install: npm install browserify-es6-modules es6-module-transpiler
// In your build script:
var browserify = require('browserify');
var b = browserify();
b.transform('browserify-es6-modules');
b.add('./entry.js');
b.bundle().pipe(process.stdout);
// Then run the script with Node.