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

Compatibility with pngquant-bin v7 #65

Open
VadimDez opened this issue Nov 8, 2021 · 5 comments
Open

Compatibility with pngquant-bin v7 #65

VadimDez opened this issue Nov 8, 2021 · 5 comments

Comments

@VadimDez
Copy link

VadimDez commented Nov 8, 2021

Found an issue, since version 7 of pngquant-bin they're using native ESM, using pngquant-bin v7+ will fail with:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: .../node_modules/pngquant-bin/index.js
require() of ES modules is not supported.
require() of .../node_modules/pngquant-bin/index.js from .../node_modules/compress-images/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename .../node_modules/pngquant-bin/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from .../node_modules/pngquant-bin/package.json.
@mathieutu
Copy link

Same for gifsicle!

@Yuriy-Svetlov
Copy link
Owner

@mathieutu

Same for gifsicle!

Temporary solution:

npm install pngquant-bin@6.0.1 --save
npm install gifsicle@5.2.1 --save

@mathieutu
Copy link

Yep, this is what I've done. 😉

@Yuriy-Svetlov
Copy link
Owner

Yuriy-Svetlov commented Nov 23, 2021

@mathieutu

Temporary solution-2:

You can also download:

https://pngquant.org/

Binary for macOS (v2.17.0)
Binary for Windows
Package for Debian
Various Linux packages

and replace in node_modules\pngquant-bin\vendor\pngquant.exe for Windows as the example.

@beatrizsmerino
Copy link

I can't upgrade these packages (gifsicle, pngquant-bin) to these versions, because they use ESModules and the compress-images package is still using CommonJS

Captura de pantalla 2024-01-07 a las 23 38 14 Captura de pantalla 2024-01-07 a las 23 41 03 Captura de pantalla 2024-01-07 a las 23 42 31 Captura de pantalla 2024-01-07 a las 23 45 45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants