4.0.0 • Published 5 years ago

babel-plugin-transform-relative-path v4.0.0

Weekly downloads
24
License
MIT
Repository
github
Last release
5 years ago

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'
	}]
]
4.0.0

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago