sindresorhus / gulp-imagemin

Minify PNG, JPEG, GIF and SVG images
MIT License
1.9k stars 157 forks source link

V8 require() of ES modules is not supported #372

Open weilinzung opened 2 years ago

weilinzung commented 2 years ago

We have a custom build tool that used v7.1.0 but does not work with the M1 chip, same as https://github.com/sindresorhus/gulp-imagemin/issues/369.

Then we went to v8.0.0, then we got require() of ES modules is not supported error.

And because have to use commonjs to compile with another custom binary, so we can't change to es module for compiling.

Could we get some solutions you may suggest?

thealiyasar commented 2 years ago

same problem...

thealiyasar commented 2 years ago

I solved this problem by downgrading.

npm install --save-dev gulp-imagemin@7.1.0

Stay happy.

weilinzung commented 2 years ago

I solved this problem by downgrading.

npm install --save-dev gulp-imagemin@7.1.0

Stay happy.

With lately m1 chip we got fn is not a function with 7.1

wang-xiaowu commented 2 years ago

same question, but v7.1.0 is working my computer's version

处理器 AMD Ryzen 7 4800U with Radeon Graphics            1.80 GHz
机带 RAM  16.0 GB (15.4 GB 可用)
系统类型    64 位操作系统, 基于 x64 的处理器
meacodes commented 2 years ago

I solved this problem by downgrading.

npm install --save-dev gulp-imagemin@7.1.0

Stay happy.

it's work for me to. thanks

Luneldevwb commented 1 year ago

Thanks, it's work for me.

skeddles commented 1 year ago

gulp-imagemin@7.1.0 has a security issue listed by npm audit

trim-newlines  <3.0.1
Severity: high
Uncontrolled Resource Consumption in trim-newlines - https://github.com/advisories/GHSA-7p7h-4mm5-852v

perhaps the maintainer could create a separate branch for version 7 so we could update it?

theamnesic commented 1 year ago

Hi!

Same here, I need help I can't make v8 works...

I can't find documentation except this.

My code doesn't return error but do not compile images :

function images(cb) {
  async () => {
    imagemin = await import('gulp-imagemin');
  },
  () => src([paths.images + '**/*'])
    .pipe(imagemin.default([
      imagemin.gifsicle({interlaced: true}),
      imagemin.mozjpeg({progressive: true}),
      imagemin.optipng({optimizationLevel: 5}),
    ]))
    .pipe(dest(paths.assets + paths.images))
    .pipe(livereload());
    cb();
}

exports.default = series(
  images,
);

Thanks!