1.0.5 • Published 4 years ago

multi-zip-plugin v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

"# multi-zip-plugin"

Due to a business requirement, each time the file output by webpack needs to be repacked into multiple zip packages as needed, but after searching for a suitable plug-in, I wrote my own.

API:

class:MultiZipPlugin
new MultiZipPlugin(options);
options: [{
    entrys: [],     // After webpack is packaged, you need to enter the file name array of the zip package
    zipName: "",    // name of zip package
}]

The following gives a vue.config.js configuration of vue-cli3 (not clear why vue needs to wrap an additional array here)

let multiZipPlugin = require("./src/plugin/multi-zip-plugin/index");

let pages = {
    page1: {
        entry: 'src/main.js',
        template: 'public/index.html',
        filename: 'page1.html',
    },
    page2: {
        entry: 'src/main_1.js',
        template: 'public/index.html',
        filename: 'page2.html',
    }
}

//not clear why vue needs to wrap an additional array here
let configs = [];
let options = [];
for (let page in pages){
    let option = {
        entrys: ["js", page + ".html"],
        zipName: page,
        zipPath: "",
    }
    options.push(option);
}

configs.push(options);

module.exports = {
    pages: pages,
    lintOnSave: false,
    chainWebpack: config => {
        config.plugin('multi-zip-plugin')
                .use(multiZipPlugin, configs);
    }
}
1.0.5

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago