prettier-vscode: Cannot load config file on Windows with latest prettier (3.x)

Summary

When opening on windows after updating to latest prettier I am getting the error below. This same error occurs if I move the config into package.json instead of an rc file. It just cant get to package.json instead of .prettierrc

["INFO" - 8:40:19 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 8:40:19 PM] Extension Version: 9.19.0.
["INFO" - 8:40:20 PM] Using config file at 'f:\path-to\my\project\.prettierrc'
["ERROR" - 8:40:21 PM] Error handling text editor change
["ERROR" - 8:40:21 PM] Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'f:'
Error: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'f:'

Steps To Reproduce:

  1. Create an empty project with a .prettierrc in the root on windows.
  2. Try to load the extension

Expected result

Should load the config file successfully

Actual result

Error is thrown

VS Code Version: 1.79.2

Prettier Extension Version: Extension Version: 9.19.0.

OS and version: Windows 11

Workaround Downgrade to "prettier": "^2.8.8", for now.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 17
  • Comments: 17 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I had this issue as well. I downgraded to v2 to get prettier working again.

Just a friendly ping to bump the activity on this issue… 😺

Can confirm, same here after updating dependencies in a project. Hopefully this gets addressed. Have to downgrade in the meantime.

I’m also experiencing this issue

Is this still a no go? The plugin is still on 2.x?

I am also suffering here))

I can also reproduce this by running prettier from the command line on Windows, in addition to the VS Code issue described.