JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26
  • Score
    100M100P100Q74241F
  • License MIT

Converts var longname; to var a;

Package Exports

  • babel-plugin-transform-mangle

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-transform-mangle) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-plugin-transform-mangle

Mangle Identifiers that can be shortened

Install

npm install babel-plugin-transform-mangle --save-dev

Example

In :

import MyAwesomeLib from 'my-awesome-lib';
const ReallyLongName = "1";
class BlahBlahBlahBlah {
  method() {}
}
function doSomethingWithAReallyLongName() {
  var localVariable, someIdentifier;
}

Out :

import a from 'my-awesome-lib';
const b = "1";
class c {
  method() {}
}
function d() {
  var a, b;
}

Options

  • keep_fnames: [Default: false] Don't mangle function names for FunctionExpressions and FunctionDeclarations - Useful for code depending on fn.name.

  • mangle_globals: [Default: false] Mangle variables in the outermost scope.