Shortcut import
Dependency-free, lightweight babel plugin that allows using shortcuts in import
and require
declarations.
Installation
npm install babel-plugin-shortcut-import --save-dev
Configuration
In .babelrc
write:
Then you can define your own shortcuts for directiories. For example:
Now every shortcutted import like:
;
Will be translated by babel to:
;
Translated path is relative, so it may be different depending on the location of the source file.
It works for require
function also.
Inspired by babel-plugin-root-import