babel-plugin-project-relative-require
v2.0.3
Published
A Bable plugin for importing modules relative to the current working directory (cwd)
Downloads
13
Readme
babel-plugin-project-relative-require
A Bable plugin for importing modules relative to the current working directory (cwd). Idea taken from FakeRainBrigand answer http://stackoverflow.com/a/31069137/1329668
Example
In
import myModule from 'cwd://mymyModule';
Out
import myModule from '<relative_path_from_your_current_place>mymyModule';
Installation
$ npm install babel-plugin-project-relative-require
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["babel-plugin-project-relative-require"]
}
Via CLI
$ babel --plugins babel-plugin-project-relative-require script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["babel-plugin-project-relative-require"]
});