tailwindlabs / prettier-plugin-tailwindcss

A Prettier plugin for Tailwind CSS that automatically sorts classes based on our recommended class order.
MIT License
5.67k stars 134 forks source link

Declare some required dependencies #296

Closed akx closed 5 months ago

akx commented 5 months ago

ast-types is required (https://github.com/tailwindlabs/prettier-plugin-tailwindcss/blob/efea6f924c2e57fa8f8169231e802466bb5fe9ce/src/index.ts#L6), but isn't declared as a dependency.

When using e.g. pnpm, it doesn't get hoisted into node_modules from being recast's transitive dependency:

$ pnpm why ast-types
Legend: production dependency, optional only, dev only

prettier-plugin-tailwindcss@0.6.5 /Users/akx/build/prettier-plugin-tailwindcss

devDependencies:
recast 0.20.5
└── ast-types 0.14.2

so build fails:

> node build.mjs --minify

✘ [ERROR] Could not resolve "ast-types"

    src/index.ts:6:26:
      6 │ import * as astTypes from 'ast-types'

The same stands for @babel/types with a slightly different error (since it's not esbuild but dts complaining).

With these added, things work again:

$ git clean -fdx . -e .idea && pnpm i && pnpm build
[...]
Progress: resolved 607, reused 548, downloaded 0, added 548, done
[...]
DTS ⚡️ Build success in 516ms
$
thecrypticace commented 5 months ago

Thanks!