Webpack packing error Cannot read property 'emit' of undefined

< H2 > webpack reported an error when using the compression-webpack-plugin plug-in < / H2 >

related codes

const CompressionPlugin = require ("compression-webpack-plugin")

webpackConfig.plugins.push (

)
new CompressionPlugin({
  // asset: "[path].gz[query]",
  algorithm: "gzip",
  test: new RegExp(
    "\\.(js)$" 
    // "\\.(" +
    // configItem.productionGzipExtensions.join("|") +
    // ")$"
  ),
  threshold: 10240,
  minRatio: 0.8
})

errors are as follows

compiler.hooks.emit.tapAsync ({name: "CompressionPlugin"}, emit);

)
               ^

TypeError: Cannot read property "emit" of undefined

at CompressionPlugin.apply (C:\MyWayProject\2018\vue\ehrAdmin\node_modules\compression-webpack-plugin\dist\index.js:175:20)
Jul.06,2021

if I lower the compression-webpack-plugin to 1.1.12, I won't make a mistake


I also don't know if it's an es6 grammar problem


how to maintain the project later?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ebe7ef-4879a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ebe7ef-4879a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?