GoogleChromeLabs/squoosh

add support for node engine 18 for @squoosh/lib

pumano opened this issue ยท 26 comments

Is your feature request related to a problem? Please describe.
Problem when l need to use --ignore-engines flag for using @squoosh/lib with nodejs 18

Describe the solution you'd like
add support nodejs 18 to:

https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/package.json#L22-L24

Does other service/app have this feature?
Add any service you know/use that has this feature (We want to know for research)
https://github.com/bcheidemann/squoosh-webpack-plugin
Additional context
Add any other context or screenshots about the feature request here.

dasa commented

This change may be need too: emscripten-core/emscripten#16917

Can somebody confirm if this mean that when a package is published relying on squoosh it will crash the package on the client if they don't have node 14 or 16? I was about to use squoosh in a published gltf converter.

Any updates on this? Is there a workaround for now? Thank you in advance.

Please let us know if a PR would be welcome for this issue. Thanks! ๐Ÿ™

Upvote this

I filed #1265 but I suspect my issue is actually related to using Node 18

bump

Are we just thinking of updating the engine rules? No changes needed from squoosh itself?

Switching to Node 18, I get this error.

TypeError: Failed to parse URL from /foo/node_modules/@squoosh/lib/build/imagequant_node-a4aafbae.wasm
    at Object.fetch (node:internal/deps/undici/undici:11118:11) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL

Found the issue - #1033.

I am getting this error too.

TypeError: Failed to parse URL from ......./node_modules/@squoosh/lib/build/imagequant_node-a4aafbae.wasm

Node.js 18

work around for node >= 18, run node --no-experimental-fetch ./script.js

Hello @GoogleChromeLabs team!
cc @surma @jakearchibald ๐Ÿ˜ธ

Any news about NodeJS 18 support? This is a serious issue.
I was surprised that the latest version of Squoosh was published more than a year ago..

The v16 is now in "maintenance" mode and will be dropped 2023.
See https://github.com/nodejs/release#release-schedule.

work around for node >= 18, run node --no-experimental-fetch ./script.js

can you share your ./scripts.js ? or a sample code ?
thanks

@limenote simply run node with the --no-experimental-fetch flag, and don't rely on the native fetch implementation.

but is squoosh to be supported?

running --no-experimental-fetch worked for me

Unfortunately, due to a few people leaving the team, and staffing issues resulting from the current economic climate (ugh), the CLI and libsquoosh packages are no longer actively maintained. I know that sucks, but there simply isn't the time & people to work on this. If anyone from the community wants to fork it, you have my blessing. The squoosh.app web app will continue to be supported and improved.

@jakearchibald
Does the squoosh.app web app support rest endpoints or some way of using it programmatically?

@jakearchibald Can you or someone else suggest some good alternatives to @squoosh/lib?

@websours if you need similar functionality in a library format for Node.js, I would consider Sharp, which is based on libvips. There appears to be some effort underway to bring libvips to WASM for web browsers as well. Since Node.js 18 is the subject of the thread here, I've confirmed that Sharp is working fine in that environment.

@jakearchibald sad, but that's so reflective of the reality of open source projects right now, see project like Atom inside Github team...

Anyway, thanks a lot for letting us know! ๐Ÿ™ ๐Ÿ˜‰

@JacobWeisenburger

@jakearchibald Does the squoosh.app web app support rest endpoints or some way of using it programmatically?

It doesn't. It's entirely client side. Part of the privacy benefits is the image doesn't leave your device.

Sounds good. thanks.

I'm using yarn to build my Next.js application using the command yarn build and getting this error. How could I run --no-experimental-fetch with yarn?

I'm using yarn to build my Next.js application using the command yarn build and getting this error. How could I run --no-experimental-fetch with yarn?

"build": "NODE_OPTIONS=--openssl-legacy-provider NODE_OPTIONS=--no-experimental-fetch next build"

its work for me