Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR in minimizer function doesn't return the 'data' property or result is not a 'Buffer' value #65

Open
myarmolinsky opened this issue Jun 19, 2024 · 0 comments

Comments

@myarmolinsky
Copy link

What were you expecting to happen?

I expected to get the minimized .svg files.

What actually happened?

I get errors for each of my svg files: ERROR in minimizer function doesn't return the 'data' property or result is not a 'Buffer' value
Note: I only see this in production mode, development mode doesn't show any errors

Please give us a sample of your webpack.config.js

...
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');
...
config = {
  ...
  optimization: {
    ...
    minimizer: [
      ...
      new ImageMinimizerPlugin({
	minimizer: {
	  implementation: ImageMinimizerPlugin.imageminMinify,
	  options: {
	    // Lossless optimization with custom option
	    plugins: [
	      ['gifsicle', { interlaced: true }],
              ['jpegtran', { progressive: true }],
	      ['optipng', { optimizationLevel: 5 }],
	      // Svgo configuration here https://github.com/svg/svgo#configuration
	      [
	        'svgo',
	        {
	          plugins: [
		    {
		      name: 'preset-default',
		      params: {
		        overrides: {
		          removeViewBox: false,
		          addAttributesToSVGElement: {
			    params: {
			      attributes: [{ xmlns: 'http://www.w3.org/2000/svg' }],
			    },
		          },
		        },
		      },
		    },
	          ],
	        },
	      ],
	    ],
	  },
        },
      }),
      ...
    ]
    ...
  }
  ...
}

Terminal output / screenshots

The following is displayed for each svg file:

ERROR in ./src/img/usage.svg
Module Error (from ./node_modules/image-minimizer-webpack-plugin/dist/loader.js):
minimizer function doesn't return the 'data' property or result is not a 'Buffer' value
// there's also a stack trace after this ^ but it doesn't have anything about imagemin, only my codebase

After the above is displayed for each file, I see the following error repeated 24 times: ERROR in minimizer function doesn't return the 'data' property or result is not a 'Buffer' value

Please provide the following information:

OS & version: Windows 11 Pro version 22H2 build 22621.3737
node version (run node -v): 20.14.0
npm version (run npm -v): 10.7.0
Webpack version (run npx webpack -v): 5.91.0
imagemin version: 9.0.0
imagemin-svgo: 11.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant