Big news!Introducing Socket AI - ChatGPT-Powered Threat Analysis. Learn more
Socket
Log inDemoInstall

babel-plugin-relative-import

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Issues
File Explorer

Advanced tools

babel-plugin-relative-import

Babel Plugin to enable relative imports

    1.0.3latest
    GitHub

Version published
Maintainers
1
Weekly downloads
657
decreased by-40.54%

Weekly downloads

Readme

Source

Babel Plugin Relative Import

Build Status Dependency Status devDependency Status https://github.com/mgcrea/babel-plugin-relative-import

Import relative files with ease

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:

{ "plugins": [ "babel-plugin-relative-import" ] }

Options

You can use a custom root with the rootPathSuffix option.

{ "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 from Michael J. Zoidl.

FAQs

Last updated on 11 May 2016

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc