# babel-plugin-relative-import **Repository Path**: mirrors_skratchdot/babel-plugin-relative-import ## Basic Information - **Project Name**: babel-plugin-relative-import - **Description**: Import relative files with ease - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-25 - **Last Updated**: 2026-05-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Babel Plugin Relative Import [![Build Status](https://travis-ci.org/mgcrea/babel-plugin-relative-import.svg?branch=master)](https://travis-ci.org/mgcrea/babel-plugin-relative-import) [![Dependency Status](https://david-dm.org/mgcrea/babel-plugin-relative-import.svg)](https://david-dm.org/mgcrea/babel-plugin-relative-import) [![devDependency Status](https://david-dm.org/mgcrea/babel-plugin-relative-import/dev-status.svg)](https://david-dm.org/mgcrea/babel-plugin-relative-import#info=devDependencies) [![https://github.com/mgcrea/babel-plugin-relative-import](https://img.shields.io/npm/dm/babel-plugin-relative-import.svg)](https://www.npmjs.com/package/babel-plugin-relative-import) Import relative files with ease ```js import fooHelper from '~/helpers/example.js'; // Gets compiled to: import fooHelper from './../../../helpers/foo.js'; // No more relative path mess! ``` ## Quickstart ``` npm install babel-plugin-relative-import --save-dev ``` Add a `.babelrc` file and write: ```js { "plugins": [ "babel-plugin-relative-import" ] } ``` ## Options You can use a custom root with the `rootPathSuffix` option. ```js { "plugins": [ ["babel-plugin-relative-import", { "rootPathSuffix": "src/js" }] ] } ``` You can also use a path starting with `%/` in your `rootPathSuffix` to automatically resolve the closest `package.json`. ## Inspiration Inspired by the [babel-root-import](https://github.com/michaelzoidl/babel-root-import) from Michael J. Zoidl.