-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Custom plugin settings: TypeError: imagemin.<plugin name> is not a function #365
Comments
Workaround solutionThe problem is resolved by importing the imagemin modules directly after adding the packages to the local project. I guess the fix is to either update the docs, or move the imagemin from package.json "devDependencies": {
"browser-sync": "^2.27.5",
"del": "^6.0.0",
"fancy-log": "^1.3.3",
"gulp": "^4.0.2",
"gulp-imagemin": "^8.0.0",
"gulp-sass": "^5.0.0",
+ "imagemin": "^8.0.1",
+ "imagemin-mozjpeg": "^9.0.0",
+ "imagemin-optipng": "^8.0.0",
+ "imagemin-svgo": "^10.0.0",
"sass": "^1.42.1"
}
gulpfile.js diff import gulpSass from 'gulp-sass';
import dartSass from 'sass';
import del from 'del';
import browserSync from 'browser-sync';
import imagemin from 'gulp-imagemin';
+import imageminOptipng from 'imagemin-optipng';
+import imageminSvgo from 'imagemin-svgo';
+import imageminMozjpeg from 'imagemin-svgo';
import fancyLog from 'fancy-log';
function images() {
return gulp.src(paths.images.source, {since: gulp.lastRun(images)})
+ .pipe(imagemin([
+ imageminOptipng({ optimizationLevel: 5 }),
+ imageminSvgo({
+ plugins: [
+ { removeViewBox: true },
+ { cleanupIDs: false }
+ ]
+ }),
+ imageminMozjpeg({ quality: 75, progressive: false })
+ ]))
.pipe(gulp.dest(paths.images.destination));
} |
Although this workaround introduces this deprecation warning from
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error
Doesn't seem to detect any of the plugins and fails on whatever it hits first, in the above error imagemin.optipng. I've tried adding
imagemin
andimagemin-*
packages to my repository, but this does not help.My implementation appears to match the package expectations. Am I missing something here?
Environment
node v16.10.0
npm 7.24.0
macOS Catalina 10.15.7
gulpfile.js
package.json
The text was updated successfully, but these errors were encountered: