-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Upgrade prettier as a dev dependency breaks non ESM react projects #15098
Comments
👋 @dominikzogg! I think that this is an issue with Jest which is being tracked at jestjs/jest#13495. Please correct me if I am wrong and we will re-open this issue. |
@kachkaev thanks for the fast response. I can't tell jest and prettier 3 in a pure backend project works. I probably have to look more deeply into esm, even when i dislike what i know of (no dynamic import, which i need in some projects), to understand the real issue. |
Hi @dominikzogg! I recently ran into a similar issue, the another way to solve this is to use Prettier also uses it: |
Hi 👋 I believe the issue here and Jest's difficulties to upgrade to Prettier v3 are not related, and it would be worth re-opening this issue @kachkaev The issue here is that the generated var prettierPromise = import("./index.mjs"); which comes from there: https://github.com/prettier/prettier/blob/main/src/index.cjs#L3 If you export a We need to have an answer on our side so we know if we need to enable this flag or if we can wait for a fix or your exported build? |
🤔 oh you're totally right, just tested this with no flag and it totally works. Gotta learn something every day 😅 Thanks for your quick answer! |
It's broken since jest runs in vm, and it requires |
Environments:
Steps to reproduce:
Create commonjs variant of a react application using prettier 2.x as a dev dependency => works.
Then upgrade to version 3.0 and then receive the following errors for example running tests:
Expected behavior:
I would expect it would not break other code, when upgrading from 2.x to 3.0.0.
As you can see this in the only change after i ran
Actual behavior:
I breaks for example jest tests.
The text was updated successfully, but these errors were encountered: