Babel plugin to add the opportunity to use import and require with root-based paths. Install with your package manager of choice. Add it to your plugins array in your babel config. For recent react-native versions, add it as a plugin in babel.config.js. You can configure this plugin by changing the string plugin name to a two-item array. Note that this array is nested inside the plugins array. By default, the import will be relative to the working directory of the process running babel. Typically this means you'll have import paths like ~/src/foo.js. You can change the prefix of "./" to e.g. "src" or "src/js" with this config option. By default everything is resolved relative to the current working directory. You can change this with the root config option. To use it effectively, you'll need to configure babel with one of the JavaScript config file variants, rather than JSON.
Features
- Install with your package manager of choice
- Use import and require with root based paths
- Supportstemplate literals in dynamic import/require
- Add it to your plugins array in your babel config
- Transform paths for custom functions
- By default everything is resolved relative to the current working directory