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

fix: update ESM output to increase interop #1

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

stipsan
Copy link
Contributor

@stipsan stipsan commented Mar 21, 2024

Makes it a type: module package, which has higher ecosystem interop than the legacy behaviour of treating .js files as CJS.

},
"license": "MIT",
"author": "Espen Hovlandsdal <[email protected]>",
"sideEffects": false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helps treeshaking in bundlers like rollup and webpack

Comment on lines -8 to -11
"node": {
"import": "./dist/use-hot-module-reload.esm.mjs",
"require": "./dist/use-hot-module-reload.cjs.js"
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not needed since they resolve to the same files as the upper level require and import conditions

@@ -3,8 +3,7 @@
"compilerOptions": {
"outDir": "lib",
"strict": true,
"esModuleInterop": true,
"module": "ES2020",
"module": "Preserve",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esModuleInterop is true when using module: preserve. More details: microsoft/TypeScript#56785

Copy link
Owner

@rexxars rexxars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@rexxars rexxars merged commit 5f0bbfc into rexxars:main Mar 22, 2024
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.

2 participants