Nicely Pointed Mandibles
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    babel-root-slash-importpublic

    Babel Root Import

    Babel plugin to add the opportunity to use import with root based paths.

    Example

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

    Install

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

    Use

    Add a .babelrc file and write:

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

    or pass the plugin with the plugins-flag on CLI

    babel-node myfile.js --plugins babel-root-slash-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-slash-import", {
          "rootPathSuffix": "src/js"
        }]
      ]
    }

    Motivate

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

    Keywords

    none

    install

    npm i babel-root-slash-import

    Downloadslast 7 days

    3,544

    version

    1.1.0

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar