
If the latest plugin version causes issues in your project, this guide documents
a confirmed-working legacy setup using pinned, older versions of
prettier-plugin-tailwindcss and @ianvs/prettier-plugin-sort-imports. No
Object.create patch is needed here — the older API is simpler and more
forgiving.
💡 Looking for the latest version setup instead?
Head over to the Latest Version Setup Guide which usesprettier-plugin-tailwindcss ^0.8.0with theObject.createfix.
prettier-plugin-tailwindcss changed its internal plugin-chaining mechanism
in v0.8.0. If you:
Object.create .name patch for your plugin combination…then pinning to ^0.7.2 is the safest fallback.
| Package | Version |
|---|---|
prettier | ^3.8.3 |
@ianvs/prettier-plugin-sort-imports | ^4.4.0 |
prettier-plugin-tailwindcss | ^0.7.2 |
⚠️ Do NOT upgrade
prettier-plugin-tailwindcssbeyond^0.7.2in this setup — it will break import sorting on VS Code save without additional patching.
npm install -D prettier@ @ianvs/prettier-plugin-sort-imports prettier-plugin-tailwindcss@^0.7.2
This installs exact major ranges. Using @ pins the install to your specified
versions so future npm install runs won't unexpectedly upgrade them.
.prettierrcCreate a .prettierrc file in your project root:
{
"plugins": [
"@ianvs/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss"
],
"importOrder": [
"^react$",
"^next(/.*)?$",
"<THIRD_PARTY_MODULES>",
"",
"^@/components/ui/(.*)$",
"^@/components/(.*)$",
"^@/hooks/(.*)$",
"^@/lib/(.*)$",
"^@/utils/(.*)$",
"^@/types/(.*)$",
"^@/(.*)$",
"",
"^[./]"
],
"importOrderTypeScriptVersion": "5.0.0",
"importOrderParserPlugins": ["typescript", "jsx", "decorators-legacy"]
}
Why plugin names as strings?
Inprettier-plugin-tailwindcss ^0.7.x, passing plugin names as strings is the supported approach. The version^0.8.0+changed this, requiring theObject.createpatch. With strings, Prettier resolves the plugins fromnode_modulesautomatically — simpler and less error-prone.
⚠️ If you have an existing
prettier.config.jsorprettier.config.mjs, delete it first — multiple config files cause Prettier to behave unpredictably.
Add to your project-level .vscode/settings.json (create it if it doesn't
exist):
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
Make sure you have the Prettier — Code formatter VS Code extension installed
(esbenp.prettier-vscode).
Open any .tsx file, scramble the import order, then hit Save. Both should
happen at once:
importOrder patternYou can also verify from the terminal:
npx prettier --write components/test-prettier.tsx
| Symptom | Likely Cause | Fix |
|---|---|---|
| The CLI shows peer dependency conflicts while installation, | Errors caused by strict peer dependency | Use prettier-plugin-tailwindcss@^0.7.2 --legacy-peer-deps |
| Imports don't sort on save, but work in terminal | Plugin version too new (≥ 0.8.0) | Downgrade to prettier-plugin-tailwindcss@^0.7.2 |
| Tailwind classes sort but imports don't | Plugin order wrong | Put @ianvs/prettier-plugin-sort-imports before prettier-plugin-tailwindcss |
Prettier crashes on .tsx files | Missing parser plugins | Ensure importOrderParserPlugins: ["typescript", "jsx", "decorators-legacy"] is set |
| Nothing formats on save | VS Code not using project Prettier | Check .vscode/settings.json has "editor.defaultFormatter": "esbenp.prettier-vscode" |
| Both plugins conflict on upgrade | prettier-plugin-tailwindcss ≥ 0.8.0 | Either stay on ^0.7.2 or switch to the latest version guide |
The legacy ^0.7.2 setup avoids the .name chaining requirement entirely —
making it the go-to fallback when the newer Object.create patch approach
doesn't suit your project. Pin your versions, use string-based plugin references,
and you'll have a stable formatter that works reliably on every VS Code save.
🔗 Want to use the latest versions instead?
Check out the Latest Version Setup Guide usingprettier-plugin-tailwindcss ^0.8.0with theObject.createfix for full compatibility with the newest Prettier ecosystem.