https://github.com/ekoeryanto/module-igniter
https://github.com/ekoeryanto/module-igniter
automation caller igniter instantiate loader module node nodejs rollup-plugin webpack-plugin
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/ekoeryanto/module-igniter
- Owner: ekoeryanto
- License: mit
- Created: 2018-05-11T22:40:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T04:07:10.000Z (about 7 years ago)
- Last Synced: 2025-09-08T23:35:47.907Z (about 1 month ago)
- Topics: automation, caller, igniter, instantiate, loader, module, node, nodejs, rollup-plugin, webpack-plugin
- Language: JavaScript
- Size: 124 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://standardjs.com)
[](https://codecov.io/gh/ekoeryanto/module-igniter)
[](https://travis-ci.org/ekoeryanto/module-igniter)
[](https://ci.appveyor.com/project/ekoeryanto/module-igniter/branch/master)
[](https://circleci.com/gh/ekoeryanto/module-igniter/tree/master)# NodeJS Module Igniter
Automatic call nodejs module, originally created for load rollup-plugins.
## Install
### Using NPM
```bash
npm i module-igniter
```### Using Yarn
```bash
yarn add module-igniter
```## Usage
### Without Argument
```js
const igniter = require("module-igniter");
const plug = igniter({ prefix: "rollup-plugin-" });
plug("commonjs", "node-resolve");
// or plug(['commonjs', 'node-resolve'])
// result [require('rollup-plugin-commonjs')(), require('rollup-plugin-node-resolve')()]
```### With Single Argument
```js
const igniter = require("module-igniter");
const plug = igniter({prefix: 'rollup-plugin-'})// single array argument
plug({ foo: [["hello"]] });
// result [require('foo')(['hello])]
plug({replace: {'process.env.NODE_ENV': JSON.stringify(environment)})
// result [require('rollup-plugin-replace')({'process.env.NODE_ENV': JSON.stringify(environment)})]
```### With multiple Arguments
```js
const igniter = require("module-igniter");
const plug = igniter();// single array argument
plug({ foo: [["hello"], { bar: "baz" }] });
// result [require('foo')(['hello], {bar: 'baz'})]
```### Optional Environment (Last Boolean Parameter)
```js
const igniter = require('module-igniter')
const plug = igniter({prefix: 'rollup-plugin-'})
plug({replace: {'process.env.NODE_ENV': JSON.stringify(environment)}, false)
// result []
```### Class Based Plugin (Webpack)
```js
const igniter = require("module-igniter");
const plug = igniter({ classic: true });
plug({
"html-webpack-plugin": {
filename: "assets/admin.html"
}
});
// result [new require('html-webpack-plugin')({filename: 'assets/admin.html'})]
```## Example
See [here](https://github.com/ekoeryanto/netlify-cms-widget-starter-rollup/blob/89ad4bdd4460076beb6adc182c35d683897a1607/rollup.config.js) for real usage example
## License
MIT