Skip to content
Add the opportunity to import modules by the root path
Branch: master
Clone or download
Pull request Compare This branch is 7 commits ahead, 141 commits behind entwicklerstube:master.
arunoda Merge pull request #2 from obsidianart/patch-1
Clarify is all or nothing
Latest commit d2640d5 Dec 5, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Remove webpack - use babel as compiler Nov 30, 2015
plugin Add support to run inside Meteor. Jun 23, 2016
test Add '/' as the root identifier instead of '~/' Jan 22, 2016
.babelrc Update babelrc, load presets Nov 30, 2015
.eslintrc Add eslintrc with airbnb definitions Aug 7, 2015
.gitignore ignore the build folder Nov 30, 2015
.travis.yml Add travis yml Aug 7, 2015 Update Jun 23, 2016
LICENSE Clarify is all or nothing Dec 5, 2016
index.js Update npm publish stuff Nov 30, 2015
package.json 1.1.0 Jun 23, 2016

Babel Root Import

Babel plugin to change the behaviour of import to root based paths.


// Usually
import SomeExample from '../../../some/example.js';

// With Babel-Root-Importer
import SomeExample from '/some/example.js';


npm install babel-root-slash-import --save-dev


Add a .babelrc file and write:

  "plugins": [

or pass the plugin with the plugins-flag on CLI

babel-node myfile.js --plugins babel-root-slash-import


If you want a custom root because for example all your files are in the src/js folder you can define this in your .babelrc file

  "plugins": [
    ["babel-root-slash-import", {
      "rootPathSuffix": "src/js"


If you like this project just give it a star :) I like stars.

You can’t perform that action at this time.