Babel plugin to add the opportunity to use import
with root based paths.
// Usually
import SomeExample from '../../../some/example.js';
// With Babel-Root-Importer
import SomeExample from '~/some/example.js';
npm install babel-root-import --save-dev
Add a .babelrc
file and write:
{
"plugins": [
"babel-root-import"
]
}
//or, if all your scripts in 'src/js' folder:
{
"plugins": [
["babel-root-import", {"rootPathSuffix": "src/js"}]
]
}
or pass the plugin with the plugins-flag on CLI
babel-node myfile.js --plugins babel-root-import
If you like this project just give it a star :) I like stars.
- Updated plugin to new babel6 API
- Splitted tests and functions into two scopes with single tests
- Removed the "extra-root" param for the .babelrc since this is no yet supported in babel6
Breaking Change to Babel 5
- Updated to Babel 6
- Added integration tests
- Added / updated tests
- Implemented ESlint