mimosa-esperanto-es6-modules
raw JSON → 0.3.4 verified Fri May 01 auth: no javascript maintenance
An ES6 module transpiler plugin for Mimosa build tool that uses Esperanto to convert ES6 module syntax (import/export) to AMD or CommonJS compatible JavaScript with inline source maps. Version 0.3.4 is the latest release; the package appears to be in maintenance mode, with no updates since 2015. It wraps the now-deprecated Esperanto library, which was a predecessor to Babel-like tools. Key differentiator: integrates directly with Mimosa's asset pipeline, allowing automatic transpilation during build. Alternative to Babel integration for Mimosa, but limited to module syntax transpilation only (no ES6 features like arrow functions, classes, etc.). Requires Node >=0.10.
Common errors
error Error: Cannot find module 'esperanto' ↓
cause esperanto dependency not installed (missing from node_modules).
fix
Ensure esperanto is installed: npm install esperanto --save-dev, or run 'mimosa install' if using Mimosa's module system.
error SyntaxError: Unexpected token import ↓
cause Mimosa is not configured to use the module; the 'esperanto-es6-modules' module is missing from the modules list.
fix
Add 'esperanto-es6-modules' to the modules array in mimosa-config.js.
error TypeError: Cannot read property 'type' of undefined ↓
cause esperanto configuration object is missing or nil in mimosa-config.
fix
Ensure the 'esperanto' property exists in the exported config object (e.g., esperanto: { type: 'amd' }).
Warnings
deprecated Esperanto is no longer maintained; use Babel or similar instead. ↓
fix Switch to a more modern transpiler like mimosa-babel or mimosa-es6-transpiler.
gotcha Only transpiles ES6 module syntax, not other ES6 features (e.g., arrow functions, classes). ↓
fix Use additional transpiler for other ES6 features, or migrate to a full-featured transpiler like Babel.
breaking Node >=0.10 only supported; may not work on Node 6+ without issues. ↓
fix Use Node 0.10 to 0.12 for guaranteed compatibility, or upgrade to alternative plugin.
gotcha CoffeeScript users must wrap import/export in backticks to avoid being transpiled by CoffeeScript. ↓
fix Enclose ES6 module syntax in backticks within CoffeeScript files.
deprecated mimosa-esperanto-es6-modules version 0.3.4 is the final release; no future updates. ↓
fix Consider using mimosa-babel or mimosa-webpack.
Install
npm install mimosa-esperanto-es6-modules yarn add mimosa-esperanto-es6-modules pnpm add mimosa-esperanto-es6-modules Imports
- esperanto wrong
var esperanto = require('esperanto')correctimport esperanto from 'esperanto' - mimosa-esperanto-es6-modules (plugin config) wrong
Adding the package name directly as a module without the 'esperanto-es6-modules' stringcorrectAdd 'esperanto-es6-modules' to your mimosa config's `modules` array in `mimosa-config.js` - EsperantoOptions (TypeScript) wrong
Directly typing as anycorrecttype EsperantoOptions = { type: 'amd' | 'commonjs'; exclude: RegExp[]; options: { strict: boolean } }
Quickstart
// In mimosa-config.js
module.exports = {
modules: ['esperanto-es6-modules'],
esperanto: {
type: 'commonjs',
exclude: [/[/\\]vendor[/\\]/, /[/\\]main[\.-]/, /\.main\.js$/, /[/\\]common\.js$/],
options: {
strict: true
}
}
};
// Input (ES6 module): src/app.js
import { version } from './utils';
export function greet() {
return 'Hello ' + version;
}
// Output (CommonJS via mimosa build)
var esperanto = require('esperanto');
// Mimosa processes files automatically; no direct call needed.