-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
}, | ||
"license": "MIT", | ||
"author": "Espen Hovlandsdal <[email protected]>", | ||
"sideEffects": false, |
There was a problem hiding this comment.
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
"node": { | ||
"import": "./dist/use-hot-module-reload.esm.mjs", | ||
"require": "./dist/use-hot-module-reload.cjs.js" | ||
}, |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Makes it a
type: module
package, which has higher ecosystem interop than the legacy behaviour of treating.js
files as CJS.