prettier-plugin-tailwindcss icon indicating copy to clipboard operation
prettier-plugin-tailwindcss copied to clipboard

Cannot find package '@ianvs/prettier-plugin-sort-imports'

Open SerenModz21 opened this issue 1 year ago • 1 comments

What version of prettier-plugin-tailwindcss are you using?

0.6.6

What version of Tailwind CSS are you using?

3.4.10

What version of Node.js are you using?

20.17.0

What package manager are you using?

Yarn v4.4.1

What operating system are you using?

Windows

Reproduction URL

I don't have a specific reproduction URL but multiple repos that experience this issue. One of those that is public is my website's repo: https://github.com/SerenModz21/serenmodz.rocks

If using my website's repo to reproduce the issue, the tailwind prettier plugin will need to be set back to ^0.6.6 because I have downgraded it for now, until something can be resolved.

After changing the version to the above, run yarn followed by yarn format and the error will be shown.

Describe your issue

When trying to format with the latest version, the following error is shown:

❯ yarn format
[error] Cannot find package '@ianvs/prettier-plugin-sort-imports' imported from [redacted]\serenmodz.rocks\node_modules\prettier-plugin-tailwindcss\dist\index.mjs
[error] Did you mean to import "@ianvs/prettier-plugin-sort-imports/lib/src/index.js"?

While I understand the "cannot find package" is due to me not having @ianvs/prettier-plugin-sort-imports installed, we're not required to need it and I don't want to sort my imports, just tailwind classes.

As mentioned above, I have decided to downgrade back to 0.6.5 until this has been resolved.

SerenModz21 avatar Aug 25 '24 01:08 SerenModz21

Downgrading to 0.6.5 fixes the issue.

felixdorn avatar Sep 17 '24 11:09 felixdorn

Sorry for getting to this so late. Seeing as you've updated to 0.6.11 I'm guessing this is no longer an issue for you. The error looks like Yarn wasn't resolving packages correctly with regards to ESM maybe.

thecrypticace avatar Jul 01 '25 21:07 thecrypticace

Sorry for getting to this so late. Seeing as you've updated to 0.6.11 I'm guessing this is no longer an issue for you. The error looks like Yarn wasn't resolving packages correctly with regards to ESM maybe.

I'm sorry; 0.6.11 did indeed resolve the issue. I had updated the plugin when I updated to Tailwind v4 (https://github.com/SerenModz21/seren.dev/pull/370), but completely forgot to update this issue.

Thank you for closing it!

SerenModz21 avatar Jul 02 '25 16:07 SerenModz21