mimp
v1.4.3
Published
Import npm modules in ES6/ES2015 way ('mimp' is modules import)
Downloads
2
Maintainers
Readme
Installation
npm i --save mimp
Changelog
- 1.4.3 Fix: auto-detect dependency name in other case
Usage
Instead of doing this in each of your *.js:
const _ = require('lodash')
const Joi = require('joi')
const when = require('when')
const RxNode = require('rx-node')
const AWS = require('aws-sdk')
// ...
You can do this now:
const {_, Joi, when, RxNode, AWS} = require('mimp')
Or if your environment support imports:
import {_, Joi, when, RxNode, AWS} from 'mimp'
Configuration (optional)
Define custom names (optional)
./src/modules.js
module.exports = {
_: 'lodash',
RxNode: 'rx-node',
AWS: 'aws-sdk'
}
You need not to provide names like this:
Joi: joi
- other casewhen: when
- same name
It will be done automatically!
Add options to package.json
"mimp": {
"aliases": "./src/modules.js",
"verbose": true
}
Options
- path String (optional) Path to custom module names definition
- verbose Boolean (default: false) Print message on import