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

Convert to using exports in package.json #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

cmdcolin
Copy link
Contributor

The "module" field is not standard, but helps bundlers understand the 'esm' intent which improves tree shaking, etc.

This changes to using the more standard package.json "exports"

Some exports docs here https://nodejs.org/api/packages.html#package-entry-points

This is still 'dual cjs/esm' but to try to enable a more "pure esm" concept compared to just "module" which still uses node.js module resolution, I added a new typescript option called 'path rewriting'. This makes us import from .ts extensions in the src directory, which changes to imports with the .js extension after building with tsc https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/

@cmdcolin
Copy link
Contributor Author

(this package was a small low effort attempt since this package is small and self contained. it could be propagated more largely through other data parsers and even the jbrowse codebase if successful though)

motivated somewhat by this issue where we have trouble with vite at dev time, potentially due to our "module" field not being recognized by esbuild (vite dev time) and so the commonjs builds are used which is sensitive to the order of imports causing weird crashes...

mui/material-ui#44180

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.

1 participant