We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a3acfd6 commit 7c1318fCopy full SHA for 7c1318f
1 file changed
packages/nx/src/command-line/format/format.ts
@@ -277,10 +277,12 @@ function getPrettierPath() {
277
278
const { packageJson, path: packageJsonPath } =
279
readModulePackageJson('prettier');
280
- prettierPath = path.resolve(
281
- path.dirname(packageJsonPath),
282
- packageJson.bin as string
283
- );
+ const bin = packageJson.bin;
+ const binPath = typeof bin === 'string' ? bin : bin?.['prettier'];
+ if (!binPath) {
+ throw new Error(`Could not find prettier binary in ${packageJsonPath}`);
284
+ }
285
+ prettierPath = path.resolve(path.dirname(packageJsonPath), binPath);
286
287
return prettierPath;
288
}
0 commit comments