mimosa-es6-module-transpiler
raw JSON → 0.6.0 verified Fri May 01 auth: no javascript maintenance
An ES6 module transpiler plugin for the Mimosa build tool, version 0.6.0 (stable, no recent updates). It transpiles ES6 module syntax to AMD, CommonJS, or global module formats, wrapping square's es6-module-transpiler. Key differentiators: tight integration with Mimosa, support for CoffeeScript backtick escaping, and exclusion patterns for vendor files. However, it does not support source maps, has limited ES6 syntax coverage, and depends on an outdated transpiler that may not reflect current spec.
Common errors
error Error: Cannot find module 'es6-module-transpiler' ↓
cause Missing dependency es6-module-transpiler
fix
Run npm install es6-module-transpiler in your project directory.
error TypeError: Cannot read property 'amd' of undefined ↓
cause The config option es6Modules.type is misspelled or not set
fix
Ensure es6Modules.type is one of 'amd', 'common', or 'globals'.
Warnings
breaking Does not support source maps; existing source maps will be invalid. ↓
fix Do not rely on source maps with this plugin. Consider alternative transpilers like Babel.
deprecated The ES6 spec has evolved; this transpiler may not support current syntax (e.g., default exports). ↓
fix Switch to Babel or TypeScript for modern ES6+ module support.
gotcha CoffeeScript backtick required for ES6 syntax to survive CoffeeScript compilation. ↓
fix Use backticks around import/export statements in .coffee files.
gotcha Exclude regex patterns may accidentally include desired files if not careful. ↓
fix Review the exclude list and customize as needed for your project structure.
Install
npm install mimosa-es6-module-transpiler yarn add mimosa-es6-module-transpiler pnpm add mimosa-es6-module-transpiler Imports
- Default wrong
const es6Transpiler = require('mimosa-es6-module-transpiler')correctimport es6Transpiler from 'mimosa-es6-module-transpiler' - registration wrong
require('mimosa-es6-module-transpiler').register()correct// In mimosa-config: modules: ['es6-module-transpiler']
Quickstart
// Install Mimosa (if not already)
npm install -g mimosa
// Create a project and add config
// In mimosa-config.coffee:
modules: ['es6-module-transpiler']
es6Modules:
type:'amd'
inferName:true
exclude: [/[/\\]vendor[/\\]/, /[/\\]main[\.-]/, /-main.js$/, /[/\\]common.js$/]
globals:{}
// Write a file with ES6 module syntax, e.g., app.js:
import $ from 'jquery';
export default function() { return $('body'); };
// Run Mimosa to build
mimosa build