Skip to content

feat: add browser export#39

Open
leonardlib wants to merge 1 commit intocatdad-experiments:masterfrom
leonardlib:master
Open

feat: add browser export#39
leonardlib wants to merge 1 commit intocatdad-experiments:masterfrom
leonardlib:master

Conversation

@leonardlib
Copy link
Copy Markdown

@leonardlib leonardlib commented Jul 25, 2024

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:

DefinitelyTyped/DefinitelyTyped#69983

But it also requires adding the exports field to the package.json to tell the NodeJS engine that there is a submodule called browser.

References:

https://nodejs.org/api/packages.html#subpath-exports
DefinitelyTyped/DefinitelyTyped#69983 (comment)

@catdad
Copy link
Copy Markdown
Member

catdad commented Jul 26, 2024

Hello! Thanks for contributing.

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

@leonardlib
Copy link
Copy Markdown
Author

leonardlib commented Jul 26, 2024

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: DefinitelyTyped/DefinitelyTyped#69983, but it also requires adding the exports field to the package.json to tell the NodeJS engine that there is submodule browser.

References:

@taylorhakes
Copy link
Copy Markdown

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

@kyselberg
Copy link
Copy Markdown

this would be very helpful if merged

@BuZZ-dEE
Copy link
Copy Markdown

I had also this issue.

DefinitelyTyped/DefinitelyTyped#69573

@leonardlib
Copy link
Copy Markdown
Author

Hello @catdad, any news about this change?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants