Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prettier Code Formatter for VS code fails with 'No loader specified for extension ".cjs"'

In VS Code, When I select Format Document With... then choose Prettier - Code Formatter, I get the following error:

Command 'Format Document' resulted in an error (No loader specified for extension ".cjs", so searchPlaces item ".prettierrc.cjs" is invalid)

From what I can gather this has something to do with underlying TypeScript in VS Code not having a loader available for .cjs files and Prettier searching for prettierrc.cjs but I can't quite see how that all fits together, or how to work around it.

Has anyone else encountered, found a work around or solved this or a similar issue in VS Code?

like image 668
Andrew Lewis Avatar asked Oct 07 '20 05:10

Andrew Lewis


1 Answers

I tried disabling the Prettier VS Code extension and enabling it again and that fixed the issue for me.

Credits @NikolajDamLarsen

like image 186
Dheeraj Bhaskar Avatar answered Sep 20 '22 17:09

Dheeraj Bhaskar