Does Webpack Compression Plugin ignore file types even when specified in options?

Viewed 557

while trying to build my Vue project using vue-cli (version 4.2.3), I wanted to use the plugin "compression-webpack-plugin" in order to minimize my project size.

For this I created a simple vue.config.js at the root of my project file with the following content:

const CompressionPlugin = require('compression-webpack-plugin');

const myCompressionPlugin = new CompressionPlugin({
    algorithm: 'gzip',
    test: /\.(jpeg|jpg|svg|png|jpg|js|css|eot|woff|ttf)$/i,
})

module.exports = {
  chainWebpack(config) {
    config.plugins.delete('prefetch');
    config.plugin('CompressionPlugin').use(myCompressionPlugin);
  }
};

After running the npm run build command, the dist folder is created without error and some files specified in options are coming in two formats (original and .gz). However this is not the case for every file format.

For example all the .png files have a zipped version but not the .jpeg files. As well .ttf files have a zipped version but not the .eot files.

Is the webpack compression plugin not working for every file types? Is the plugin not able to compress those formats and simply ignore them?

Thank you for the help.

0 Answers
Related