Socket
Socket
Sign inDemoInstall

babel-import-from-root

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-import-from-root

Babel Plugin to enable relative root-import


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Install size
8.63 kB
Created
Weekly downloads
 

Readme

Source

Babel Root Import

Babel plugin to add the opportunity to use import with root based paths.
Build Status Codacy Badge Dependency Status devDependency Status https://github.com/michaelzoidl/babel-root-import

Example

// Usually
import SomeExample from '../../../some/example.js';

// With Babel-Root-Importer
import SomeExample from '@/some/example.js';

Install

npm install babel-root-import --save-dev

Use

Add a .babelrc file and write:

{
  "plugins": [
    "babel-root-import"
  ]
}

or pass the plugin with the plugins-flag on CLI

babel-node myfile.js --plugins babel-root-import

Extras

If you want a custom root because for example all your files are in the src/js folder you can define this in your .babelrc file

{
  "plugins": [
    ["babel-root-import", {
      "rootPathSuffix": "src/js"
    }]
  ]
}

Motivate

If you like this project just give it a star :) I like stars.

Change Log

3.1.3 - 2015-12-21
  • Add build
3.1.2 - 2015-12-21
  • Update README
3.1.1 - 2015-12-21
  • Forked to rewrite and add custom home prefix
3.1.0 - 2015-12-01
  • Add possibility config the custom root path
3.0.1 - 2015-11-30
  • Updated plugin to new babel6 API
  • Splitted tests and functions into two scopes with single tests
  • Removed the "extra-root" param for the .babelrc since this is no yet supported in babel6
2.0.1 - 2015-11-15

Breaking Change to Babel 5

  • Updated to Babel 6
  • Added integration tests
1.0.1 - 2015-08-07
  • Added / updated tests
  • Implemented ESlint

FAQs

Last updated on 21 Dec 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • 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