# babel-plugin-local-import

> A babel plugin for aliasing local module import

Latest version **0.2.4** (published 2019-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-local-import
pnpm add babel-plugin-local-import
yarn add babel-plugin-local-import
bun add babel-plugin-local-import
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2019-06-28 |
| First published | 2019-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Derek Ray |
| Maintainers | raythorn |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-local-import
- Repository: https://github.com/raythorn/babel-plugin-local-import
- Homepage: https://github.com/raythorn/babel-plugin-local-import#readme
- Issues: https://github.com/raythorn/babel-plugin-local-import/issues
- npm.io page: https://npm.io/package/babel-plugin-local-import

## Recent versions

- 0.2.4 (latest) — 2019-06-28
- 0.2.3 — 2019-06-28
- 0.2.2 — 2019-06-03
- 0.2.1 — 2019-06-03
- 0.2.0 — 2019-06-03
- 0.1.6 — 2019-05-31
- 0.1.5 — 2019-05-31
- 0.1.4 — 2019-05-31
- 0.1.3 — 2019-05-31
- 0.1.2 — 2019-05-31
- 0.1.1 — 2019-05-31
- 0.1.0 — 2019-05-31

## README

# babel-plugin-local-import

[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]

[npm-image]: http://img.shields.io/npm/v/babel-plugin-local-import.svg?style=flat-square
[npm-url]: http://npmjs.org/package/babel-plugin-local-import
[download-image]: https://img.shields.io/npm/dm/babel-plugin-local-import.svg?style=flat-square
[download-url]: https://npmjs.org/package/babel-plugin-local-import

## install
   [![ljshell](https://nodei.co/npm/babel-plugin-local-import.png)](https://npmjs.org/package/babel-plugin-local-import)

### Feature
----
A simple babel plugin for importing local module as in node_modules, 
and don't need to write tediously long relative path while importing.

### Keywords
----
* babel plugin
* import module
* local module
* relative path
* import module on demand

### Usage
---
configure local module path in .babelrc, for example, a local module in './local/path/moduleA'
```json
{
    "plugins": [
        ["local-import", { 
            "libraryName": "moduleA", 
            "libraryDirectory": "./local/path" 
        }],
        ["local-import", { 
            "libraryName": "moduleB", 
            "libraryDirectory": "./local/path",
            "subdirectory": "src/components",
            "camel2dash": true,
            "expand": true,
        }],
    ]
}
```
and now, we can import component from 'moduleA' just as it's installed node_modules directory:
```js
import test from 'moduleA';
```
which will be compiled as:
```js
import test from './local/path/moduleA';
```
---
if you want import component from 'moduleB' on demand:
```js
import { TestFunc, TestParam } from 'moduleB';
```
which will be compiled as:
```js
import TestFunc from './local/path/moduleB/src/components/test-func';
import TestParam from './local/path/moduleB/src/components/test-param';
```

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