ES6 Module Transpiler (toranb fork)

raw JSON →
0.0.2 verified Fri May 01 auth: no javascript deprecated

A temporary fork of the es6-module-transpiler incorporating PR #100. The ES6 Module Transpiler (original by Square) is an experimental compiler that allows writing JavaScript using a subset of the ES6 module syntax and compiling to AMD or CommonJS modules. This fork version 0.0.2 was published on npm as a stopgap fix. The project is now obsolete as ES6 module syntax has stabilized and native support exists. Key differentiator: this fork includes a specific patch not yet merged upstream at the time.

error Cannot find module 'es6-module-transpiler'
cause The package name on npm is 'toranb-es6-module-transpiler', not 'es6-module-transpiler'.
fix
npm install toranb-es6-module-transpiler and require('toranb-es6-module-transpiler')
error Module not found: Error: Can't resolve 'es6-module-transpiler'
cause Using a bundler like webpack with an incorrect import path.
fix
Use require('toranb-es6-module-transpiler') or configure webpack resolve.alias.
deprecated This package is a temporary fork and is no longer maintained. Use native ES modules or modern bundlers.
fix Migrate to ES6 modules natively or use a stable transpiler like Babel.
gotcha The package version 0.0.2 is experimental and may not reflect final ES6 spec syntax.
fix Do not rely on this for production code; only for experimentation.
gotcha This fork includes a specific PR #100 fix; check the upstream repository for merged changes.
fix Use the official package if the fix has been merged upstream.
npm install toranb-es6-module-transpiler
yarn add toranb-es6-module-transpiler
pnpm add toranb-es6-module-transpiler

Demonstrates using the Compiler class to transpile ES6 module syntax to AMD output.

var Compiler = require('es6-module-transpiler').Compiler;
var inputString = 'import { foo } from "bar"; export var baz = foo;';
var compiler = new Compiler(inputString, 'myModule');
var output = compiler.toAMD();
console.log(output);