1.0.7 • Published 5 years ago
node-extract v1.0.7
extract.js
Assembly of modules node.js into one file
Install
npm i node-extract
Usage
const extract = require('node-extract');
extract({
/* configuration */
}, () => {
/* callback */
});
Configuration
Param | Type | Default | Description |
---|---|---|---|
input | string | null | Input .js file path |
output | string | null | Output .js file path |
debug | int | 1 | Debug level (0-2) |
depth | int | 30 | Maximum iteration depth |
exclude | array | [] | Listing of exclude files |
share | array | [] | Listing of not require files |
polyfill | boolean | true | Use polyfills in modules |
Example
const extract = require('node-extract');
extract({
input: 'index.js',
output: 'index.dist.js',
debug: 1,
exclude: [
'./config.json'
],
share: [
'socket.io-client/dist/socket.io.js.map',
'socket.io-client/dist/socket.io.js'
]
});
INPUT index.js
var server = require('http');
var io = require('socket.io');
var localConfig = require('./config.json');
var colors = require('colors');
OUTPUT index.dist.js
var server = require('http'); // is default node module
var io = $___module___10055();
var localConfig = require('./config.json'); // is exclude
var colors = $___module___10067();
// ...
function $___module___10055() {
var exports = {};
var module = { exports };
// module body
return module.exports;
}
// ...