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

gulp-imagemin plugin crashes with an error. #377

Open
hannasorokina opened this issue Dec 23, 2022 · 3 comments
Open

gulp-imagemin plugin crashes with an error. #377

hannasorokina opened this issue Dec 23, 2022 · 3 comments

Comments

@hannasorokina
Copy link

hannasorokina commented Dec 23, 2022

I use gulp-imagemin im my gulp as ESM. When I run my gulp task with gulp-imagemin plugin, I've got the issue:

gulp-imagemin: Could not load default plugin `gifsicle`
gulp-imagemin: Could not load default plugin `mozjpeg`
gulp-imagemin: Could not load default plugin `optipng`

image

Windiws 10 x64
Gulp version: "gulp": "^4.0.2";
Plugin version: "gulp-imagemin": "^8.0.0".
Node version: v18.12.0.

Does anybody has some solution for the issue?

@tomasvn
Copy link

tomasvn commented Feb 2, 2023

@hannasorokina You have to install those plugins as dev dependency, even though it says in the readme that gulp-imagemin comes bundled with those plugins

@Stephan-Pe
Copy link

had the same issue, my solution is:
imagemin/imagemin#411

@chesio
Copy link

chesio commented Mar 22, 2023

had the same issue, my solution is: imagemin/imagemin#411

@Stephan-Pe Your issue is different - you have to update the configuration of SVGO options. See also: #359

The problem reported by OP (@hannasorokina) can be solved by explicitly importing the plugins:

import imagemin from 'gulp-imagemin';
import { gifsicle, mozjpeg, optipng } from 'gulp-imagemin';

It doesn't seem necessary to install those plugins as dev dependency as @tomasvn suggested (at least I didn't have to do it in my project).

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

4 participants