# babel-plugin-provide-modules

> A babel plugin to Automatically load modules.

Latest version **1.0.3** (published 2016-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-provide-modules
pnpm add babel-plugin-provide-modules
yarn add babel-plugin-provide-modules
bun add babel-plugin-provide-modules
```

## 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.3 |
| Published | 2016-04-01 |
| First published | 2015-09-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.x |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Maintainers | tomatao |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-provide-modules
- Repository: https://github.com/tomatau/babel-plugin-provide-modules
- Homepage: https://github.com/tomatau/babel-plugin-provide-modules#readme
- Issues: https://github.com/tomatau/babel-plugin-provide-modules/issues
- npm.io page: https://npm.io/package/babel-plugin-provide-modules

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.2.1

## Recent versions

- 1.0.3 (latest) — 2016-04-01
- 1.0.2 — 2016-02-07
- 1.0.1 — 2016-02-07
- 1.0.0 — 2016-02-07
- 0.2.1 — 2015-09-27
- 0.2.0 — 2015-09-19
- 0.1.0 — 2015-09-19

## README

# Provide Modules

A babel plugin to Automatically load modules.

Module (value) is loaded and the identifier (key) is used as free variable. The identifier is filled with the exports of the loaded module.

## Usage

```shell
npm install --save babel babel-plugin-provide-modules
```

The add plugin to .babelrc along with options.

```js
{
  "plugins": [
    ["provide-modules", {
      "debug": "debug", // default
      "lodash": ["get", "assign"], // de-structured
      "react-dom": [{"findDOMNode" : "find"}], // de-structured with alias
      // both default and de-structured imports with alias
      "react": {
        default: "React",
        destructured: ["PropTypes", {"cloneElement": "clone" }],
      }
    }]
  ]
}
```

The above will inject the following into every file:

```js
import debug from 'debug';
import {get, assign} from 'lodash';
import {findDOMNode as find} from 'react-dom';
import React, {PropTypes, cloneElement as clone} from 'react';
```

If any file already contains a binding defined in options, the binding will not be inserted.

For example, given the same options above and the following file:

```js
const debug = 'some value';
```

Debug will not be automatically loaded for that file.

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