# babel-plugin-module-mapper

> [![Build Status](https://travis-ci.org/broven/babel-plugin-module-mapper.svg?branch=master)](https://travis-ci.org/broven/babel-plugin-module-mapper)

Latest version **1.3.2** (published 2020-01-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-module-mapper
pnpm add babel-plugin-module-mapper
yarn add babel-plugin-module-mapper
bun add babel-plugin-module-mapper
```

## 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.3.2 |
| Published | 2020-01-14 |
| First published | 2020-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | metajs |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-module-mapper
- npm.io page: https://npm.io/package/babel-plugin-module-mapper

## Dependencies (2)

- [jest](https://npm.io/package/jest.md) ^24.9.0
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.7.7

## Recent versions

- 1.3.2 (latest) — 2020-01-14
- 1.3.1 — 2020-01-14
- 1.3.0 — 2020-01-14
- 1.2.0 — 2020-01-14
- 1.1.0 — 2020-01-09
- 1.0.0 — 2020-01-07

## README

# babel-plugin-module-mapper
[![Build Status](https://travis-ci.org/broven/babel-plugin-module-mapper.svg?branch=master)](https://travis-ci.org/broven/babel-plugin-module-mapper)


# TODO
- generate only one import when transform to exist import declaretion

This plugin aim to map particular import to another module.

## demo

for some reason, you can't modify code, you need babel to do this

```javascript
import { createElement, PropTypes } from 'react';
```
to
```javascript
import { createElement } from 'react';
import PropTypes from 'prop-types';
```

## config
```jsonc

{
    '${targetModuleName}': {
        '${targetExport (defaultExport alias to default)}': ['${targetModuleName}', '${targetExportName}', ${targetLocalName?}]
    }
}

// demo config for demo
{
    'react': {
        'PropTypes': ['prop-types', 'default']
    }
}
```
## targetLocalName
```jsonc
    {
     'preact': {
         'preact': ['preact', 'default', 'React']
     }
    }
```
transform:
```javascript
import preact from 'preact';
// will transform to:
import React from 'preact';
```

# lis

WTF lis.

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