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
When using a shared Prettier configuration (in my case within a Turborepo setup) that includes @ianvs/prettier-plugin-sort-imports, everything works fine until I run cleaning scripts that remove all node_modules. After cleaning, even though I reinstall dependencies, running Prettier (via pnpm run format) results in an error that mentions a noop.js file. It appears that Prettier cannot locate the plugin module, even though it is listed as a dependency in my shared config.
To Reproduce
Set up a Turborepo with a shared Prettier config package (e.g. @craftzcode/prettier-config) that includes:
@ianvs/prettier-plugin-sort-imports and prettier-plugin-tailwindcss in its dependencies.
A config file (index.js) exporting the Prettier configuration with a plugins array including the sort imports plugin.
In one of the consuming packages (e.g. @craftzcode/ui), reference the shared config using the "prettier": "@craftzcode/prettier-config" field in package.json.
Run the cleaning scripts:
pnpm run clean
pnpm run clean:workspaces
(These scripts run git clean -xdf .cache .turbo node_modules.)
Reinstall dependencies using:
pnpm install
Run the formatting command:
pnpm run format
Observe the error referencing noop.js from @ianvs/prettier-plugin-sort-imports.
Expected behavior
Prettier should correctly resolve and load the @ianvs/prettier-plugin-sort-imports plugin even after cleaning and reinstalling dependencies, without error.
Additional Debugging Notes
- The issue only appears after running cleaning scripts (git clean -xdf .cache .turbo node_modules), which removes all installed packages.
- Reinstalling dependencies with pnpm install is required after cleaning; however, even after reinstallation, Prettier fails to load the plugin.
- Using Prettier version ^3.5.2 with Node 23.7.0 and [email protected].
- The shared config is using ESM ("type": "module" with export default config), and the plugin is correctly listed as a dependency.
Contribute to @ianvs/prettier-plugin-sort-imports
I'm willing to fix this bug 🥇
The text was updated successfully, but these errors were encountered:
Does this still happen with only prettier-plugin-tailwindcss? This sounds to me like a compatibility issue between pnpm and prettier, or a bug in pnpm!
It sounds like when you do something, it successfully works, but only after you hard-reset and pnpm install does something go weird?
Your Environment
Describe the bug
When using a shared Prettier configuration (in my case within a Turborepo setup) that includes
@ianvs/prettier-plugin-sort-imports
, everything works fine until I run cleaning scripts that remove allnode_modules
. After cleaning, even though I reinstall dependencies, running Prettier (viapnpm run format
) results in an error that mentions anoop.js
file. It appears that Prettier cannot locate the plugin module, even though it is listed as a dependency in my shared config.To Reproduce
Set up a Turborepo with a shared Prettier config package
(e.g. @craftzcode/prettier-config)
that includes:@ianvs/prettier-plugin-sort-imports
andprettier-plugin-tailwindcss
in its dependencies.(index.js)
exporting the Prettier configuration with a plugins array including the sort imports plugin.In one of the consuming packages
(e.g. @craftzcode/ui)
, reference the shared config using the"prettier"
:"@craftzcode/prettier-config"
field inpackage.json
.Run the cleaning scripts:
(These scripts run
git clean -xdf .cache .turbo node_modules
.)noop.js
from@ianvs/prettier-plugin-sort-imports
.Expected behavior
Prettier should correctly resolve and load the
@ianvs/prettier-plugin-sort-imports
plugin even after cleaning and reinstalling dependencies, without error.Screenshots, code sample, etc
Shared Prettier Config
(@craftzcode/prettier-config/index.js)
:Consuming Package (
@craftzcode/ui/package.json
excerpt):Error log

Additional Debugging Notes
- The issue only appears after running cleaning scripts
(git clean -xdf .cache .turbo node_modules)
, which removes all installed packages.- Reinstalling dependencies with
pnpm install
is required after cleaning; however, even after reinstallation, Prettier fails to load the plugin.- Using
Prettier version ^3.5.2
withNode 23.7.0
and[email protected]
.- The shared config is using ESM (
"type": "module"
withexport default config
), and the plugin is correctly listed as a dependency.Contribute to @ianvs/prettier-plugin-sort-imports
The text was updated successfully, but these errors were encountered: