esmangle is a ECMAScript code mangler and minifier that operates on Mozilla Parser API AST. It is part of the estools ecosystem (esprima, escodegen) and is designed to work with AST-based transformations for JavaScript minification. Version 1.0.11 is the latest stable release, but the project appears to be unmaintained (last release in 2014). Key differentiators: supports both Node.js and browser environments, provides optimize and mangle passes, and integrates with esprima for parsing and escodegen for code generation.
npm install esmangle2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
This demonstrates the full pipeline: parsing code with esprima, optimizing and mangling with esmangle, then generating minified code with escodegen.
Migrate to terser or esbuild for active development and ES6+ support.
Transpile modern code to ES5 before using esmangle, or switch to a minifier that supports ES6+.
Run via npx or install locally: npx esmangle file.js
Use a CDN link or include script tag. Note that it pollutes the global scope.
Run 'npm install esmangle' or add it to package.json.
Use 'esprima.parseScript(code)' for modules or 'esprima.parseScript(code, { jsx: true })' if using JSX. For ES5, 'esprima.parse(code)' works but is deprecated.Ensure you use the correct named import: 'const { mangle } = require("esmangle");' or 'import { mangle } from "esmangle";'No dependency data recorded yet.