You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: support Yarn PnP SDK prettierPath entry file (#3911) (#3914)
* Fix Yarn PnP SDK module resolution when prettierPath points to a file
When `prettier.prettierPath` is set to a file path like
`.yarn/sdks/prettier/index.cjs` (common in Yarn PnP SDK setups),
the extension incorrectly treated it as a directory and tried to
read `index.cjs/package.json`, causing module loading to fail.
This fix:
- In `ModuleResolverNode.ts`: Check if the path is a file and use
the parent directory to find `package.json`
- In `PrettierDynamicInstance.ts`: Detect `.js/.cjs/.mjs` file
extensions and use the file directly instead of resolving
Fixes the error:
"Failed to load module... index.cjs/package.json"
* Add test for Yarn PnP SDK prettierPath file resolution
Add test fixture and test case to verify that the extension correctly
handles `prettierPath` pointing to a `.cjs` file, which is common in
Yarn PnP SDK setups.
Test fixture structure:
- `.yarn/sdks/prettier/index.cjs` - SDK wrapper entry point
- `.vscode/settings.json` - with prettierPath pointing to the .cjs file
* Refactor comment for clarity on modulePath usage
---------
Co-authored-by: 이준영 <54898597+ff1451@users.noreply.github.com>
0 commit comments