-
Notifications
You must be signed in to change notification settings - Fork 2.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
prettier@3+ integration #17990
Comments
I tried hacking around this in node_modules by changing to the following; let v2PrettierPath;
let v3PrettierPath;
try {
v2PrettierPath = require.resolve('prettier/bin-prettier');
} catch (e) {}
try {
v3PrettierPath = require.resolve('prettier/bin/prettier');
} catch (e) {}
const PRETTIER_PATH = v2PrettierPath || v3PrettierPath; This then started throwing a new error which indicates to me this may be an issue of cjs/esm. The offending line of code in NX is just
|
@SimeonC if you fully qualify the extension of the V3 path, e.g. |
However, that's only a partial fix because Prettier also changed their API syntax in a breaking way, so it looks like |
I found the most reliable way of doing this for my own no plugins ended up being using |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Some breaking changes were introduced with the new version of prettier.
It looks like at the very least this line will need updating:
const PRETTIER_PATH = require.resolve('prettier/bin-prettier');
)nx/packages/nx/src/command-line/format/format.ts
Line 26 in 64765eb
due to this change:
bin-prettier.js
->bin/prettier.cjs
) https://github.com/prettier/prettier/blob/e2f4ce38f7c1dac1d1ec5371670a93e3844f6b39/website/blog/2023-07-05-3.0.0.md?plain=1#L334I'm using the latest version of nx
16.5.0
Originally posted by @sebpalluel in #16121 (comment)
The text was updated successfully, but these errors were encountered: