What version of prettier-plugin-tailwindcss are you using?
v0.7.3 (regression — v0.7.2 works correctly on the same setup, also reproduced on 0.0.0-insiders.f7d2598)
What version of Tailwind CSS are you using?
v4.x
What version of Node.js are you using?
v24.11.0
What package manager are you using?
pnpm v10.28.2
What operating system are you using?
Windows 11
Reproduction URL
https://github.com/llanesluis/plugin-chaining-fails-silently
NOTE: The repo includes a REPRODUCTION_STEPS.md file for guidance.
Describe your issue
When prettier-plugin-tailwindcss@0.7.3 is combined with @ianvs/prettier-plugin-sort-imports and Prettier is invoked through the prettier-vscode VS Code extension on Windows (format on save), the sort-imports chain silently fails — imports are never reordered on save. Tailwind class sorting and base Prettier formatting still work on the same save.
Running Prettier from the CLI (prettier --write) on the same project and config works correctly: imports are reordered and grouped as expected, Tailwind class sorting and base Prettier formatting work too.
This is a regression from v0.7.2 → v0.7.3. Pinning prettier-plugin-tailwindcss@0.7.2 makes the problem disappear entirely; upgrading to 0.7.3 reintroduces it.
Identified potential root cause
In dist/index.mjs, findEnabledPlugin does:
if (typeof plugin !== "string") { plugin = plugin.name; }
if (plugin === name || isAbsolute(plugin) && plugin.includes(name) && maybeResolve(name) === plugin)
return loadIfExists(name);
Prettier CLI sets plugin.name to the package name "@ianvs/prettier-plugin-sort-imports" → plugin === name matches → chain succeeds.
prettier-vscode resolves package names to file paths before Prettier loads them, so plugin.name ends up as the native Windows path, e.g.:
D:\…\node_modules\…\@ianvs\prettier-plugin-sort-imports\lib\src\index.js
On Windows the package segment is "@ianvs\prettier-plugin-sort-imports" (backslash), but name is "@ianvs/prettier-plugin-sort-imports" (forward slash). → plugin.includes(name) returns false → chain drops silently.
Verified local patch
Applied via pnpm patch against prettier-plugin-tailwindcss@0.7.3 — after this patch, VS Code save and CLI both correctly chain the sort-imports plugin:
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -386,7 +386,9 @@ function findEnabledPlugin(options, name) {
if (!plugin.name) continue;
plugin = plugin.name;
}
- if (plugin === name || isAbsolute(plugin) && plugin.includes(name) && maybeResolve(name) === plugin) return loadIfExists(name);
+ const pluginSlashed = plugin.replace(/\\/g, "/");
+ const resolvedSlashed = maybeResolve(name)?.replace(/\\/g, "/") ?? null;
+ if (plugin === name || (isAbsolute(plugin) && pluginSlashed.includes(name) && resolvedSlashed === pluginSlashed)) return loadIfExists(name);
}
}
Tested on Windows 11 with both npm and pnpm across plain Next.js (minimal reproduction uses Next.js app) and a pnpm monorepo — both CLI and prettier-vscode save work after the patch, on paths with and without spaces.
What version of
prettier-plugin-tailwindcssare you using?v0.7.3 (regression — v0.7.2 works correctly on the same setup, also reproduced on
0.0.0-insiders.f7d2598)What version of Tailwind CSS are you using?
v4.x
What version of Node.js are you using?
v24.11.0
What package manager are you using?
pnpm v10.28.2
What operating system are you using?
Windows 11
Reproduction URL
https://github.com/llanesluis/plugin-chaining-fails-silently
NOTE: The repo includes a
REPRODUCTION_STEPS.mdfile for guidance.Describe your issue
When
prettier-plugin-tailwindcss@0.7.3is combined with@ianvs/prettier-plugin-sort-importsand Prettier is invoked through theprettier-vscodeVS Code extension on Windows (format on save), the sort-imports chain silently fails — imports are never reordered on save. Tailwind class sorting and base Prettier formatting still work on the same save.Running Prettier from the CLI (
prettier --write) on the same project and config works correctly: imports are reordered and grouped as expected, Tailwind class sorting and base Prettier formatting work too.This is a regression from v0.7.2 → v0.7.3. Pinning
prettier-plugin-tailwindcss@0.7.2makes the problem disappear entirely; upgrading to0.7.3reintroduces it.Identified potential root cause
In dist/index.mjs, findEnabledPlugin does:
Prettier CLI sets plugin.name to the package name
"@ianvs/prettier-plugin-sort-imports"→ plugin === name matches → chain succeeds.prettier-vscode resolves package names to file paths before Prettier loads them, so plugin.name ends up as the native Windows path, e.g.:
D:\…\node_modules\…\@ianvs\prettier-plugin-sort-imports\lib\src\index.jsOn Windows the package segment is
"@ianvs\prettier-plugin-sort-imports"(backslash), but name is "@ianvs/prettier-plugin-sort-imports" (forward slash). → plugin.includes(name) returns false → chain drops silently.Verified local patch
Applied via pnpm patch against prettier-plugin-tailwindcss@0.7.3 — after this patch, VS Code save and CLI both correctly chain the sort-imports plugin:
Tested on Windows 11 with both npm and pnpm across plain Next.js (minimal reproduction uses Next.js app) and a pnpm monorepo — both CLI and prettier-vscode save work after the patch, on paths with and without spaces.