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

Fix/commonjs export #57

Closed

Conversation

michielmetcake
Copy link

Fixes:
#56
and
#51

@webketje
Copy link
Member

webketje commented Nov 10, 2023

@michielmetcake Unfortunately this PR breaks all tests and is the opposite direction of where sindre intended his packages to go, see the FAQ section of sindresorhus/meta#15

Do you plan to include CommonJS fallback files?
No. Node.js 12 supports ESM natively. There's no point.

So reverting to the .cjs format is not an option. If you use imagemin directly, you can do as below for a workaround:

const loadImageminSvgo = await import('imagemin-svgo')
const imageminSvgo = loadImageminSvgo.default

If you depend on a package which expects imagemin-svgo to export a CJS module, you can only insist that the maintainers of the depending package implement this fix or migrate to another CJS-supported implementation.

I would consider adding a cjs branch which would allow one to do npm i github:imagemin/imagemin-svgo#cjs, but that would still not solve situations where imagemin-svgo is depended upon by another library.

@sindresorhus
Copy link
Contributor

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

@PizzaPete
Copy link

We're no longer blocked by this. That's why there was no activity in this PR for a while.

@imagemin imagemin locked as resolved and limited conversation to collaborators May 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants