grunt-es6-module-transpiler
raw JSON → 0.6.0 verified Fri May 01 auth: no javascript maintenance
A Grunt plugin (v0.6.0) that transpiles ES6 module syntax (import/export) into AMD, CommonJS, or globals using the es6-module-transpiler. Requires Grunt ~0.4.1 and Node >= 0.8.0. It provides a single custom task named 'es6-module-transpiler' for Grunt build systems. Unlike Babel or TypeScript, this package only handles module syntax, not full ES6-to-ES5 transpilation. The project appears unmaintained (last release 2015) and is superseded by modern tools.
Common errors
error Warning: Task "es6-module-transpiler" not found. ↓
cause Plugin not loaded or installed incorrectly.
fix
Ensure you have run 'npm install grunt-es6-module-transpiler --save-dev' and added 'grunt.loadNpmTasks('grunt-es6-module-transpiler');'.
error Fatal error: Unable to find module 'es6-module-transpiler'. ↓
cause Missing dependency 'es6-module-transpiler'.
fix
Run 'npm install es6-module-transpiler --save-dev'.
error Running "es6-module-transpiler:dist" (es6-module-transpiler) task Warning: Cannot read property 'type' of undefined ↓
cause Missing 'options' block in task configuration.
fix
Add options with at least 'type': 'amd' or 'cjs'.
Warnings
deprecated This package is no longer actively maintained. Use Babel or TypeScript for ES6 module transpilation. ↓
fix Switch to @babel/core and @babel/preset-env, or use TypeScript with esModuleInterop.
breaking Grunt ~0.4.1 is required; incompatible with Grunt 1.x. ↓
fix Downgrade Grunt to 0.4.x, or migrate to a different module transpiler.
gotcha Only transpiles module syntax, not ES6 features like arrow functions or classes. ↓
fix Use a full transpiler (e.g., Babel) for complete ES6 support.
gotcha The task name 'es6-module-transpiler' must be quoted in Gruntfile config because of hyphens. ↓
fix Always use quotes: grunt.initConfig({ 'es6-module-transpiler': {...} });
Install
npm install grunt-es6-module-transpiler yarn add grunt-es6-module-transpiler pnpm add grunt-es6-module-transpiler Imports
- grunt-es6-module-transpiler task wrong
grunt.loadTasks('node_modules/grunt-es6-module-transpiler/tasks');correctgrunt.loadNpmTasks('grunt-es6-module-transpiler'); - es6-module-transpiler wrong
var transpiler = require('grunt-es6-module-transpiler');correctvar transpiler = require('es6-module-transpiler'); - grunt.initConfig wrong
grunt.initConfig({ transpile: { ... } });correctgrunt.initConfig({ 'es6-module-transpiler': { options: { type: 'amd' }, files: { 'dest.js': 'src.js' } } });
Quickstart
// Install: npm install grunt-es6-module-transpiler --save-dev
// Load in Gruntfile:
grunt.loadNpmTasks('grunt-es6-module-transpiler');
// Configure task:
grunt.initConfig({
'es6-module-transpiler': {
dist: {
options: {
type: 'amd' // also 'cjs' or 'globals'
},
files: {
'dist/out.js': ['src/module1.js', 'src/module2.js']
}
}
}
});
// Run: grunt es6-module-transpiler