# babel-plugin-rename-umd-globals

> Renames the module's global variable and adds optional global aliases

Latest version **1.0.0** (published 2016-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-rename-umd-globals
pnpm add babel-plugin-rename-umd-globals
yarn add babel-plugin-rename-umd-globals
bun add babel-plugin-rename-umd-globals
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-11-07 |
| First published | 2016-05-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jarkko Mönkkönen |
| Maintainers | jamonkko |
| Keywords | global, module, babel, rename, umd, name, globals, export |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-rename-umd-globals
- Repository: https://github.com/jamonkko/babel-plugin-rename-umd-globals
- Homepage: https://github.com/jamonkko/babel-plugin-rename-umd-globals#readme
- Issues: https://github.com/jamonkko/babel-plugin-rename-umd-globals/issues
- npm.io page: https://npm.io/package/babel-plugin-rename-umd-globals

## Dependencies (1)

- [babel-plugin-rename-assigned-properties](https://npm.io/package/babel-plugin-rename-assigned-properties.md) ^1.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-11-07
- 0.0.4 — 2016-08-14
- 0.0.3 — 2016-07-31
- 0.0.2 — 2016-05-14
- 0.0.1 — 2016-05-11

## README

[![Build Status](https://travis-ci.org/jamonkko/babel-plugin-rename-umd-globals.svg?branch=master)](https://travis-ci.org/jamonkko/babel-plugin-rename-umd-globals)
[![Coverage Status](https://coveralls.io/repos/github/jamonkko/babel-plugin-rename-umd-globals/badge.svg?branch=master)](https://coveralls.io/github/jamonkko/babel-plugin-rename-umd-globals?branch=master)
[![npm version](https://img.shields.io/npm/v/babel-plugin-rename-umd-globals.svg?style=flat-square)](https://www.npmjs.com/package/babel-plugin-rename-umd-globals)
[![npm downloads](https://img.shields.io/npm/dm/babel-plugin-rename-umd-globals.svg?style=flat-square)](https://www.npmjs.com/package/babel-plugin-rename-umd-globals)
[![Dependency Status](https://david-dm.org/jamonkko/babel-plugin-rename-umd-globals.svg)](https://david-dm.org/jamonkko/babel-plugin-rename-umd-globals)
[![devDependency Status](https://david-dm.org/jamonkko/babel-plugin-rename-umd-globals/dev-status.svg)](https://david-dm.org/jamonkko/babel-plugin-rename-umd-globals#info=devDependencies)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
[![Sponsored by Leonidas](https://img.shields.io/badge/sponsored%20by-leonidas-389fc1.svg)](https://leonidasoy.fi/opensource)

# babel-plugin-rename-umd-globals
Rename and add aliases for global module name. Can be applied after [babel-plugin-transform-es2015-modules-umd](http://babeljs.io/docs/plugins/transform-es2015-modules-umd) to modify global module name ([example below](#together-with-other-umd-plugins)).

## Installation

```sh
# With npm
$ npm install babel-plugin-rename-umd-globals --save-dev

# With yarn 
$ yarn add babel-plugin-rename-assigned-properties --dev
```

Tested to work with Node >= 0.10

## Usage

### Options
You need to define the rename mapping with plugin options. Just map of old names to new names (and their optional aliases). 

### Example via `.babelrc`

Transform `global.myModule = value` to `global.MyM = value`

```json
{
  "plugins": [
    ["rename-umd-globals", {
      "myModule": "MyM"
    }]
  ]
}
```

### More examples via `.babelrc`

You can also add aliases for global module name by providing array. It will be transformed to chained assignments of global module name.

```json
{
  "plugins": [
    ["rename-umd-globals", {
      "coolio": ["Coolio", "C", "ArtisLeonIveyJr"]
    }]
  ]
}
```

### Via Node API

```javascript
require("babel-core").transform("code", {
  plugins: [
    ["rename-umd-globals", {
      "myModule": "MyM"
    }]
  ]
});
```

### Together with other umd plugins

It can be combined with [babel-plugin-add-module-exports](https://github.com/59naga/babel-plugin-add-module-exports) and [babel-plugin-transform-es2015-modules-umd](http://babeljs.io/docs/plugins/transform-es2015-modules-umd). Make sure to use the same plugin order as below!

```javascript
{
  "presets": ["es2015"],
  "plugins": [
    "add-module-exports",
    "transform-es2015-modules-umd",
    ["rename-umd-globals", {
      "myModule": "MyM"
    }]
  ]
}
```


### Caveats

- Expects the *global* object to be named global. If your global scope object happens to be named differently, like *root*, then just use [babel-plugin-rename-assigned-properties](https://github.com/jamonkko/babel-plugin-rename-assigned-properties) instead for arbitrary object property renaming.

### Sponsors

[Leonidas](https://leonidasoy.fi/opensource)

---
_Source: https://npm.io/package/babel-plugin-rename-umd-globals · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
