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

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow Babel Plugin Root Import

Babel Plugin Root Import Web Site

Other Useful Business Software
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Babel Plugin Root Import!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Browser Extensions and Plugins

Registered

2022-04-07