-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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: add ESM exports of all modules manually #14661
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -117,17 +132,6 @@ export function getPackages() { | |||
}); | |||
} | |||
|
|||
export function adjustToTerminalWidth(str) { |
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 has been unused since we added the webpack build
@@ -13,6 +13,8 @@ | |||
"exports": { | |||
".": { | |||
"types": "./build/index.d.ts", | |||
"require": "./build/index.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.
I've included require
here so that bundlers/runtimes who understand both can go straight to it - no need to use the ESM wrapper
@@ -26,6 +25,14 @@ const require = createRequire(import.meta.url); | |||
export const OK = chalk.reset.inverse.bold.green(' DONE '); | |||
export const ERROR = chalk.reset.inverse.bold.red(' BOOM '); | |||
|
|||
export const typeOnlyPackages = new Set([ | |||
'babel-preset-jest', |
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 isn't types only, but there's also no build step 🤷
export default class CustomSequencer extends Sequencer.default { | ||
export default class CustomSequencer extends Sequencer { |
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 very nice, but also makes it a breaking change for people who have used Jest's modules in native ESM before. Which is probably fine, but we need to call this out in the upgrade guide
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This is to work around nodejs/cjs-module-lexer#88. We don't need to rely on a lexer as we can just check our exports at build time and create manual ESM export.
This should avoid the dual package hazard as the wrapper is pretty much their recommendation.
Test plan
Green CI