Compressed to zip webpack plugin
Sometimes we need to push the entire project to a certain system by uploading zip
, such as ci/cd
, Chrome Extension
, etc. So it is most convenient to use a compressed file.
- Automatically collect emitted files by webpack.
- Trim other files by setting the
onlyZip
option. - Implemented using jszip.
# use npm
$ npm install --dev @dumlj/zip-webpack-plugin
# use yarn
$ yarn add --dev @dumlj/zip-webpack-plugin
# use pnpm
$ pnpm add @dumlj/zip-webpack-plugin -D
import { ZipWebpackPlugin } from '@dumlj/zip-webpack-plugin'
export default {
plugins: [
new ZipWebpackPlugin({
// 默认为 false
lonely: false,
extras: {
'/not_import.js': '/do_import.js',
},
}),
],
}
In the demo, the files is output to the memory, please check the console
.
Or remove the comment writeToDisk: true
from the MemfsWebpackPlugin
in webpack.config.ts
and run yarn build
.
@dumlj/zip-webpack-plugin ├─┬ @dumlj/seed-webpack-plugin │ ├─┬─ @dumlj/feature-updater │ │ ├─── @dumlj/shell-lib │ │ ├─── @dumlj/util-lib │ │ └─── @dumlj/mock-libPRIVATE │ └─── @dumlj/mock-libPRIVATE └── @dumlj/mock-libPRIVATE