heic-convert icon indicating copy to clipboard operation
heic-convert copied to clipboard

feat: add browser export

Open leonardlib opened this issue 1 year ago • 5 comments

leonardlib avatar Jul 25 '24 17:07 leonardlib

Hello! Thanks for contributing.

Can you please elaborate what the purpose of this is? I am not seeing exports in the pacakge.json spec.

catdad avatar Jul 26 '24 03:07 catdad

Hello! Thanks for contributing.

Can you please elaborate what the purpose of this is? I am not seeing exports in the pacakge.json spec.

Yup, sure!

I'm using the package as a module: import convert from 'heic-convert' and with TypeScript there is no problem because I'm using the @types/heic-convert package too.

But when I try to use the browser submodule: import convert from 'heic-convert/browser' with TypeScript, there is an error about missing type definitions, so I created the type definitions for the browser submodule: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69983, but it also requires adding the exports field to the package.json to tell the NodeJS engine that there is submodule browser.

References:

  • https://nodejs.org/api/packages.html#subpath-exports
  • https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69983#discussion_r1688729326

leonardlib avatar Jul 26 '24 15:07 leonardlib

I am also running into this issue. Can this be merged?

taylorhakes avatar Sep 23 '24 21:09 taylorhakes

this would be very helpful if merged

kyselberg avatar Oct 21 '24 09:10 kyselberg

I had also this issue.

https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/69573

BuZZ-dEE avatar Oct 24 '24 23:10 BuZZ-dEE