-
Notifications
You must be signed in to change notification settings - Fork 37
feat: add esm support #55
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
Conversation
@@ -1,6 +1,6 @@ | |||
{ | |||
"presets": [ | |||
["@babel/preset-env", { "targets": { "node": "8" } }]], | |||
["@babel/preset-env", { "targets": { "node": "12" } }]], |
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 is our supported version according to pkg.json
🎉 This PR is included in version 3.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
"types": "./types/index.d.ts", | ||
"import": "./dist/esm/index.js", | ||
"browser": "./dist/cjs/index.js" | ||
}, | ||
"./pure": { | ||
"types": "./pure.d.ts", | ||
"import": "./dist/esm/pure.js", | ||
"browser": "./dist/cjs/pure.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.
ESM output as .js
with no "type": "module"
? Any reason not to support Node here?
"browser"
being CJS also looks a bit odd to me, though could be fine.
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.
Yes I realised a moment ago as well, we have to output these as mjs as well
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.
Ah, apologies then!
Thanks for doing all of this!
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.
No need to apologize, was a very good shout, thanks 😄
Resolves #50
Resolves #36
What:
This adds support for importing this library as ESM. Therefore we are also introducing the concept of export maps as this will allow people to use esm for all things testing library.
Why:
We are increasingly growing towards ESM as a baseline so we should support both modes.
How:
We initiate two Babel runs, one resulting in ESM and one resulting in CJS.
Checklist: