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

Report invalid module field in package.json #68

Open
remcohaszing opened this issue Jul 24, 2023 · 2 comments
Open

Report invalid module field in package.json #68

remcohaszing opened this issue Jul 24, 2023 · 2 comments

Comments

@remcohaszing
Copy link
Contributor

Some packages define the top-level module field in package.json. Although it’s non-standard, bundlers use it. This can lead to differences between usage in the browser and Node.js, but it is not possible to add type definitions for it.

I think it would be useful to report the module field if it does not match the import condition in the package.json exports field nor the main field.

For example:

@hfhchan-plb
Copy link

openpgp also has the module field, but no corresponding exports field, so ESM only works with bundlers and not node/ts.

@andrewbranch
Copy link
Collaborator

Another interesting case: qr-creator, where main is a browser script, module is a .js file that contains ESM syntax, and types is a .d.ts file that represents module 😵‍💫

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

No branches or pull requests

3 participants