Skip to content

Commit

Permalink
build(webpack): pack extension with filemanager-webpack-plugin inst…
Browse files Browse the repository at this point in the history
…ead `zip-webpack-plugin`

`zip-webpack-plugin` incompatible with `file-loader`
also `zip-webpack-plugin` less popular than `filemanager-webpack-plugin`, and not maintained 3 years
  • Loading branch information
Gvozd committed Nov 15, 2020
1 parent 07cd06a commit 8920ea7
Show file tree
Hide file tree
Showing 3 changed files with 367 additions and 32 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.4",
"eslint-plugin-react-hooks": "^4.1.2",
"filemanager-webpack-plugin": "^3.0.0-alpha.7",
"fork-ts-checker-webpack-plugin": "^6.0.1",
"html-webpack-plugin": "^4.5.0",
"mini-css-extract-plugin": "^1.3.1",
Expand All @@ -82,7 +83,6 @@
"webpack-cli": "^4.2.0",
"webpack-extension-reloader": "^1.1.4",
"wext-manifest-loader": "^2.2.1",
"wext-manifest-webpack-plugin": "^1.2.1",
"zip-webpack-plugin": "^3.0.0"
"wext-manifest-webpack-plugin": "^1.2.1"
}
}
19 changes: 14 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const webpack = require('webpack');
const ZipPlugin = require('zip-webpack-plugin');
const FilemanagerPlugin = require('filemanager-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
Expand Down Expand Up @@ -192,10 +192,19 @@ module.exports = {
preset: ['default', {discardComments: {removeAll: true}}],
},
}),
new ZipPlugin({
path: destPath,
extension: `${getExtensionFileType(targetBrowser)}`,
filename: `${targetBrowser}`,
new FilemanagerPlugin({
events: {
onEnd: {
archive: [
{
format: 'zip',
source: path.join(destPath, targetBrowser),
destination: `${path.join(destPath, targetBrowser)}.${getExtensionFileType(targetBrowser)}`,
options: {zlib: {level: 6}},
},
],
},
},
}),
],
},
Expand Down
Loading

0 comments on commit 8920ea7

Please sign in to comment.