Klathmon / imagemin-webpack-plugin

Plugin to compress images with imagemin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using this plugin with @angular-builders/custom-webpack

MauriceNino opened this issue · comments

commented

The error I am getting when using this plugin in an Angular 13 project is the following:

[error] TypeError: Cannot assign to read only property 'main.977fe6373cfd108d.js' of object '#<Object>'
    at ImageminPlugin._callee2$ (/.../node_modules/imagemin-webpack-plugin/dist/index.js:264:48)
    at tryCatch (/.../node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:62:40)
     // ...

Other plugins (e.g. webpack-notifier) work flawlessly.

My config looks like this:

const ImageminPlugin = require("imagemin-webpack-plugin").default;
const WebpackNotifierPlugin = require("webpack-notifier");

module.exports = {
  plugins: [
    new WebpackNotifierPlugin({
      alwaysNotify: true,
      title: "BUILD SUCCESSFUL",
    }),
    new ImageminPlugin({
      pngquant: {
        quality: "95",
      },
    }),
  ],
};