Closed ghost closed 2 years ago
I also get this. Reverting to 7.1.0 solves it. Looks to me like an issue with the conversion to ESM.
Same problem here
You can solve this problem with renaming gulpfile.esm.js
back to gulpfile.js
and adding "type": "module"
to package.json
. However, there will be some restrictions:
gulpfile.js
file directly in the root directory. So you can't have an index.js
file inside gulpfile.js
directory instead.import
of a JavaScript file (except modules installed with npm
) must contain an extension.For now this is the only solution I've found for 8.0.0
.
My setup is as described (recently converted the package so it no longer uses esm). I get the error, but only on SVG files.
// Copy images
function images() {
return gulp.src(`${config.src}/img/**/*`)
.pipe(imagemin([
mozjpeg({
quality: 80,
}),
svgo({
plugins: [
{removeViewBox: false},
]
}),
imageminPngquant({
quality: [0.6, 0.8],
dithering: 1,
}),
]))
.pipe(gulp.dest(`${config.dist}/img`));
}
If I remove the SVG files from src/img the error doesn't happen.
The SVGO config format changed: https://github.com/sindresorhus/gulp-imagemin/commit/a1579c0a88232f58ce2b8b5e95e24570240fb1a4
Thanks @sindresorhus, changing the config format fixed the issue for me.
The SVGO config format changed: a1579c0
Please add this to the documentation as it would've save a lot more time.
Hi there. Sorry for noticing so late. Currently, I don't have resources to try it out, so I'll close the issue and reopen it if anything goes wrong. Thanks!
Nameless is Here!
So I'm trying to make a
gulp
task which optimises images (obviously). Here are my files:gulpfile.esm.js
./gulp/tasks/images.js
The error I get:
gulp
version: 4.0.2esm
version: 3.2.25gulp-changed
version: 4.0.3gulp-if
version: 3.0.0gulp-imagemin
version: 8.0.0,gulp-plumber
version: 1.2.1imagemin-pngquant
version: 9.0.2Any help is appreciated! Sorry for my terrible english.