Jazzle
raw JSON → 0.9.12 verified Fri May 01 auth: no javascript
Jazzle is a high-performance ECMAScript transpiler with zero dependencies, designed to convert modern JavaScript features (destructuring, classes, lexical variables, arrow functions, template strings) into ES5-compatible code. As of version 0.9.12, it is still in active development with a focus on efficiency and correctness, notably handling temporal dead zones and super-bound this references. It claims to be roughly 2x faster than Babel on early benchmarks. The package provides a programmatic API (Node.js >=6.20.0) with CLI support planned but not yet released. It differentiates itself by targeting edge cases often missed by other transpilers, while maintaining minimal footprint.
Common errors
error Error: Cannot find module 'jazzle' ↓
cause Package not installed or global install not in NODE_PATH.
fix
Run 'npm install jazzle' locally or 'npm install -g jazzle' for global CLI (though CLI not available).
error TypeError: jazzle.transform is not a function ↓
cause Using default import incorrectly (e.g., import jazzle from 'jazzle' with ESM bundler).
fix
Use 'const jazzle = require("jazzle")' and then call jazzle.transform().
error SyntaxError: Unexpected token (1:4) / unsupported feature ↓
cause Source code uses syntax not supported by Jazzle or missing sourceType option.
fix
Ensure sourceType is 'module' for ES modules, and check that the feature is supported by Jazzle.
Warnings
gotcha Options object (including sourceType) is required; omitting it may cause unexpected behavior or errors. ↓
fix Always pass an options object with at least sourceType set to 'module' or 'script' as appropriate.
gotcha CLI is not yet available despite being referenced in the README; use programmatic API only. ↓
fix Use the Node.js API via require('jazzle') for all transpilation tasks.
breaking Version 0.x may contain breaking changes between minor versions; no stability guarantees. ↓
fix Pin to a specific version and test before upgrading.
gotcha The package does not support ESM imports; only CommonJS require works. ↓
fix Use require() instead of import statements when consuming this package.
Install
npm install jazzle yarn add jazzle pnpm add jazzle Imports
- jazzle wrong
import jazzle from 'jazzle'correctconst jazzle = require('jazzle') - transform wrong
jazzle.transform(src)correctconst result = jazzle.transform(src, options) - default wrong
const { jazzle } = require('jazzle')correctconst jazzle = require('jazzle')
Quickstart
const jazzle = require('jazzle');
const src = 'let [myCoolSource] = ((a=myCoolSource) => [a])();';
const options = { sourceType: 'module' };
const result = jazzle.transform(src, options);
console.log(result.code);
// Output includes sourceMap property as well