# babel-plugin-local-scoped-modules

> babel-plugin-local-scoped-modules ================ This plugin intends to avoid typing relative paths.Use relative paths like local modules instead.

Latest version **0.120.3** (published 2023-12-27) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.120.3 |
| Published | 2023-12-27 |
| First published | 2019-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 20.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Zengnificant |
| Maintainers | zengnificant |
| Keywords | babel-plugin, relative-path, no-relative-path |

## Links

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

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.4.5

## 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

- 0.120.3 (latest) — 2023-12-27
- 0.120.1 — 2022-08-15
- 0.110.1 — 2021-06-30
- 0.100.2 — 2020-11-17
- 0.100.1 — 2020-11-15
- 0.99.2 — 2020-11-15
- 0.99.1 — 2020-11-15
- 0.3.3 — 2020-11-13
- 0.3.2 — 2020-11-13
- 0.3.1 — 2020-11-13
- 0.3.0 — 2020-11-12
- 0.2.1 — 2019-06-15
- 0.2.0 — 2019-06-15
- 0.1.4 — 2019-06-13
- 0.1.2 — 2019-06-11
- … 3 more at https://npm.io/package/babel-plugin-local-scoped-modules/versions

## README

babel-plugin-local-scoped-modules
================
This plugin intends to avoid  typing  relative paths.Use relative paths like local modules instead.


Install
---------------------------------

```shell
 yarn add  --dev  babel-plugin-local-scoped-modules 
```
**or**

```shell
 npm install --dev-save  babel-plugin-local-scoped-modules
```

Usage 
---------------------------------
Below is  a `.babelrc` config on what it is going to be like:
```js
  {
            presets: ['@babel/preset-env'],
            plugins: [
                ["babel-plugin-local-scoped-modules",{
                   //defautlt
                    rootPrefix:'~', 

                    //default 
                    scopePrefix: '@',

                    //local modules. Prefixes should be the 
                    //same as set above.
                    scopes:[{
                        name:'@abc',
                        alias:'@ab/c',
                        dir:'~/a/b/c'
                    }]
                }]
            ]
  }

```
Suppose this project hierarchy:

  `<projectRoot>/a/b/c/foo.js`

  `<projectRoot>/d/e/f/bar.js`

Now in `bar.js`, how do we suppose to quote `foo.js`?

With  the above  `.babelrc` settings,we just:
```js
 import foo from '~/a/b/c/foo' // var foo= require('~/a/b/c/foo')

```
  
 or 

```js
 import foo from '@abc/foo' //   var foo=require('@abc/foo') 

```

or 

```js
 import foo from '@ab/c/foo' //   var foo=require('@ab/c/foo') 

```

The last one could be very useful in some cases.

After transformed ,it'll work fine. These stringLiterals will turn to be a relative path.




Editor auto-completions:
---------------------------------
+ sublime plugin:
     - [LocalScopedModules](https://github.com/zengnificant/LocalScopedModules)



 Lisense
---------------------------------
  MIT

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