babel-plugin-package-name-import1.0.3 • Public • Published
Import files from the current package by name
Install it locally to your project by running:
yarn add --dev babel-plugin-package-name-import
Add the plugin to your Babel configuration:
Given that your
You can import files from the current project by name:
require is not supported as its argument can be dynamically
If your project uses Flow, ensure that it can resolve
current project imports by adding to
[options] module.name_mapper='^project$' -> '<PROJECT_ROOT>' module.name_mapper='^project\/\(.*\)$' -> '<PROJECT_ROOT>/\1'
<PROJECT_ROOT> is a special token and should be left unmodified.