Skip to content

gavriguy/babel-plugin-project-relative-require

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Note this is a Babel 5 plugin.

I'm now personally use - https://github.com/jshanson7/babel-plugin-resolver plugin that supports babel 6

babel-plugin-project-relative-require

npm version

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"]
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published