Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-import-alias

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-import-alias

Provides directory aliases for es2015 import statements

  • 1.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
768
increased by88.7%
Maintainers
1
Weekly downloads
 
Created
Source

Rollup Import Alias

Provides directory aliases for es2015 import statements.

Installation

npm install rollup-plugin-import-alias --save-dev

Usage

In rollup.plugins

var importAlias = require('rollup-plugin-import-alias');

importAlias({
    Paths: {
        TypeChecks: '../Common/TypeChecks',
	Framework: './V1.0/Framework'					
    },
    Extensions: ['js']
});

In your modules

import isArray from 'TypeChecks/isArray';

This import would actually look for file ../Common/TypeChecks/isArray

So? Why Care

As I've worked more with ES2015 import statements I've noticed absolute paths being used to avoid "import hell". This is great, but creates issues when copying files into other subdirectories that would break those paths. With this super simple utility those absolute paths can be correctly re-mapped.

Keywords

FAQs

Package last updated on 14 Jul 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc