common-chunk-ify
v0.0.1
Published
generate an extra chunk, which contains common modules shared between entry points.
Readme
Browserify plugin for Generate an extra chunk, which contains common modules shared between entry points.
Install
npm install common-chunk-ify --saveUseage
if you have some source files like this
//entry a.js
var c = require("./c");
var a1 = require("./a1");
module.exports = "a";//entry a1.js
module.exports = "a1";//entry b.js
var c = require("./c");
module.exports = "b";//c.js
module.exports = "c";Node Scripts
"use strict";
const browserify = require("browserify");
const gulp = require("gulp");
let b = browserify(["a.js","b.js"])
.plugin("common-chunk-ify",{
map:{
"a.js":"app.js"
,"b.js":"bpp.js"
}
requireName:"mycommon"
commonName:"mycommon.js"
})
b.on("bundle file",bundle=> {
bundle.pipe(gulp.dest("./dist")); // our some other custom stream
// dist/
// app.js (with a,a1)
// bpp.js (with b)
// mycommon.js (with c only)
})Tests
npm install --save-dev
npm test