sindresorhus / gulp-imagemin

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

TypeError: Invalid host defined options #362

Closed bobbyg603 closed 2 years ago

bobbyg603 commented 3 years ago

In our gulpfile.esm.js everything works just fine until we import imagemin. As soon as we add imagemin and run gulp we get the following:

bugsplat-website-new % gulp
[15:33:57] Requiring external module esm
TypeError: Invalid host defined options
    at eval (eval at <anonymous> (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/lib/shared/require-or-import.js:10:15), <anonymous>:3:1)
    at requireOrImport (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/lib/shared/require-or-import.js:24:7)
    at execute (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js:37:3)
    at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/node_modules/gulp-cli/index.js:211:24)
    at Liftoff.execute (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:201:12)
    at module.exports (/usr/local/lib/node_modules/gulp/node_modules/flagged-respawn/index.js:51:3)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:191:5)
    at /usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:149:9
    at /usr/local/lib/node_modules/gulp/node_modules/v8flags/index.js:162:14
    at /usr/local/lib/node_modules/gulp/node_modules/v8flags/index.js:41:14

We're using node 14.17.4 and npm 7.22.0.

Can someone please help us get unstuck here? Thanks!

Patta commented 2 years ago

I can confirm this issue. Fixed by replace esm package with module and native es.

sindresorhus commented 2 years ago

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

billyromano commented 2 years ago

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

✅ I just posted a comment with a fix for peeps using the code splitting technique for the gulpfile.esm.js setup.

gulpfile.esm.js code splitting fixed -->