Skip to content

Browserify plugin for Generate an extra chunk, which contains common modules shared between entry points.

Notifications You must be signed in to change notification settings

tommyZZM-archives/common-chunk-ify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Browserify plugin for Generate an extra chunk, which contains common modules shared between entry points.

Install

npm install common-chunk-ify --save

Useage

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)
})
Options
Prevent Global Pollution

Tests

npm install --save-dev
npm test

inspire by

About

Browserify plugin for Generate an extra chunk, which contains common modules shared between entry points.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published