Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Hedzer/rollup-plugin-import-alias
Provides directory aliases for es2015 import statements.
https://github.com/Hedzer/rollup-plugin-import-alias
Last synced: 25 days ago
JSON representation
Provides directory aliases for es2015 import statements.
- Host: GitHub
- URL: https://github.com/Hedzer/rollup-plugin-import-alias
- Owner: Hedzer
- Created: 2016-09-19T00:12:49.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-14T18:09:55.000Z (over 5 years ago)
- Last Synced: 2024-05-14T12:02:48.633Z (7 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 12
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - import-alias - Maps an import path to another. (Plugins / Modules)
README
Rollup Import Alias
=========Provides directory aliases for es2015 import statements.
## Installation
npm install rollup-plugin-import-alias --save-dev
## Usage
### In rollup.plugins
```javascript
var importAlias = require('rollup-plugin-import-alias');importAlias({
Paths: {
TypeChecks: '../Common/TypeChecks',
Framework: './V1.0/Framework'
},
Extensions: ['js']
});
```
### In your modules
```javascript
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.