# babel-plugin-transform-relative-path

> This babel plugin transforms a prefix in the path of a require/import to a relative path to a given directory. The plugin can be used as an alternative to using the environment variable to resolve dependencies (e.g. NODE_PATH=src), or as an alternative to

Latest version **4.0.0** (published 2019-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-transform-relative-path
pnpm add babel-plugin-transform-relative-path
yarn add babel-plugin-transform-relative-path
bun add babel-plugin-transform-relative-path
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2019-03-12 |
| First published | 2018-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 127.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Bruno Van Damme |
| Maintainers | subhero |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-transform-relative-path
- Repository: https://github.com/subhero24/babel-plugin-transform-relative-path
- Homepage: https://github.com/subhero24/babel-plugin-transform-relative-path#readme
- Issues: https://github.com/subhero24/babel-plugin-transform-relative-path/issues
- npm.io page: https://npm.io/package/babel-plugin-transform-relative-path

## Dependencies (1)

- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^1.0.5

## Recent versions

- 4.0.0 (latest) — 2019-03-12
- 3.1.1 — 2019-03-05
- 3.1.0 — 2019-03-02
- 3.0.1 — 2018-11-02
- 3.0.0 — 2018-09-10
- 2.0.3 — 2018-06-26
- 2.0.2 — 2018-06-26
- 2.0.1 — 2018-05-18
- 2.0.0 — 2018-05-18
- 1.0.2 — 2018-04-24
- 1.0.1 — 2018-04-23
- 1.0.0 — 2018-04-23
- 0.1.1 — 2018-03-20

## README

# Babel-plugin-transform-relative-path

This babel plugin transforms a prefix in the path of a require/import to a relative path to a given directory.
The plugin can be used as an alternative to using the environment variable to resolve dependencies (e.g. NODE_PATH=src),
or as an alternative to bundler aliases (e.g. webpack's alias option).

## Installation

```
yarn add babel-plugin-transform-relative-path
```

## Usage

Add the plugin to your babel config

```
"plugins": ["babel-plugin-transform-relative-path"]
```

The default maps all paths that are prefixed with '/' to the root directory.

You can change the default configuration:

```
"plugins": [
	["transform-relative-path", {
		'~': './src'
	}]
]
```

or specify multiple mappings:

```
"plugins": [
	["transform-relative-path", {
		'~': './src',
		'lib': './lib'
	}]
]
```

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