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
Gen AI apps are built with MongoDB Atlas Icon
Gen AI apps are built with MongoDB Atlas

The database for AI-powered applications.

MongoDB Atlas is the developer-friendly database used to build, scale, and run gen AI and LLM-powered apps—without needing a separate vector database. Atlas offers built-in vector search, global availability across 115+ regions, and flexible document modeling. Start building AI apps faster, all in one place.
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