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 with node 23.1 #389

Closed
echavaillaz opened this issue Nov 8, 2024 · 3 comments
Closed

Error with node 23.1 #389

echavaillaz opened this issue Nov 8, 2024 · 3 comments

Comments

@echavaillaz
Copy link

When using node 23.2, I got now this error :

Error: unexpected top-level await at file:///home/xxx/git/xxx/xxxnode_modules/gulp-imagemin/index.js:96
export const gifsicle = await exposePlugin('gifsicle');

All the export with await are broken.

@sandinmyjoints
Copy link

Same with node 22.12.0.

@backflip
Copy link
Contributor

backflip commented Dec 10, 2024

@echavaillaz, @sandinmyjoints, can you import the plugin asynchronously?

import gulp from "gulp";
// Or as CommonJS:
// const gulp = require("gulp");

gulp.task("optimize", async () => {
  const imagemin = (await import("gulp-imagemin")).default;

  return gulp
    .src("src/images/*")
    .pipe(imagemin())
    .pipe(gulp.dest("dist/images"));
});

@echavaillaz
Copy link
Author

@backflip

Ok for me it works again. Thanks for the hint.

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

3 participants