Conversation
| } | ||
|
|
||
| if (sharp) { | ||
| module.exports = sharp; |
There was a problem hiding this comment.
Conditional exports are not supported by ESM but it doesn't matter here because importing the module will throw as needed
|
This is great, thank you for doing the hard work Florian, and at less of an impact in terms of changed code than I had imagined, merci donc d'avoir fait simple. For the v0.35.x releases I'd like to maintain compatibility with versions of Node.js where ESM isn't fully available and then I suspect the v0.36.x releases (or maybe v1.0.x if I'm feeling lucky after 13 years) is the place for this to land and wish CommonJS bon voyage. As an aside, I've been invited to (and accepted) the Astro event in London in a few weeks and spotted your name on the list so I might be able to thank you in person for this. |
|
Glad I can help :) Yeah I saw you on the list for the event, looking forward to meeting you! I'll give a talk on fonts Btw I was thinking about this PR during the weekend and I don't know if the packages under |
Closes #2981
I kept this PR as minimal as I could. It introduces esbuild to be able to compile ESM to CJS to support both:
libto ESM because esbuild doesn't support transformingrequire()intoimportrequire()Things left to do where I'll need some help:
install/build.jsrequire()calls inlibvips.jsbecause they only seem consumed bybinding.gyp