-
-
Notifications
You must be signed in to change notification settings - Fork 109
Closed
Description
- compression-webpack-plugin Version: 7.1.1
Expected Behavior
The plugin to compress data as expected.
Actual Behavior
webpack crashes wtih a HookWebpackError after the plugin tries to access the indexOf
of a function.
HookWebpackError: filenameForRelatedName.indexOf is not a function
Code
// webpack.config.js
const zopfli = require("@gfx/zopfli");
module.exports = {
plugins: [
new CompressionPlugin({
filename(pathData) {
// other things here...
return "[path][name].gz";
},
algorithm(input, compressionOptions, callback) {
return zopfli.gzip(input, compressionOptions, callback);
},
}),
],
};
How Do We Reproduce?
Apparently it happens if algorithm
and filename
properties are both defined as functions.
I could be missing something but it seems the case where filename
is a function is being ignored in the section bellow.
compression-webpack-plugin/src/index.js
Lines 128 to 131 in 44c16e2
if (typeof this.options.algorithm === "function") { | |
let filenameForRelatedName = this.options.filename; | |
const index = filenameForRelatedName.indexOf("?"); |
Metadata
Metadata
Assignees
Labels
No labels