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 pass the plugin with the plugins-flag on CLI
babel-node myfile.js --plugins babel-root-import
Thanks brigand for giving me some inspiration