Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark tailwindcss as a peerDependency #50

Merged
merged 1 commit into from
Feb 26, 2021

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Feb 26, 2021

Internally we are using tailwindcss/plugin, but we don't mark it as a
peerDependency or a normal dependency in our package.json. This means
that this plugin will fail in a monorepo environment when dependnecies
get hoisted. This is because now there is no link to tailwind itself.

Marking it as a peerDependency should fix this, because now there is a
link. People that already have tailwind installed are good to go. People
that use monorepo's should benefit from this additional information.

Side note: NPM 7 starts installing peerDependencies for us https://github.com/npm/rfcs/blob/latest/implemented/0025-install-peer-deps.md
which is nice, because if we added an explicit dependency to Tailwind,
then we would always reference our dependency and not the user's
dependency.

Closes: #31

@vercel
Copy link

vercel bot commented Feb 26, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tailwindlabs/tailwindcss-forms/BRopkQg2q6e6odEBTSNSqkJM4XxM
✅ Preview: https://tailwindcss-forms-git-tailwindcss-peer-dependency-tailwindlabs.vercel.app

Internally we are using tailwindcss/plugin, but we don't mark it as a
peerDependency or a normal dependency in our package.json. This means
that this plugin will fail in a monorepo environment when dependnecies
get hoisted. This is because now there is no link to tailwind itself.

Marking it as a peerDependency should fix this, because now there is a
link. People that already have tailwind installed are good to go. People
that use monorepo's should benefit from this additional information.

Side note: NPM 7 starts installing peerDependencies for us https://github.com/npm/rfcs/blob/latest/implemented/0025-install-peer-deps.md
which is nice, because if we added an `explicit` dependency to Tailwind,
then we would always reference our dependency and not the user's
dependency.

Closes: #31
@RobinMalfait
Copy link
Member Author

Didn't test it myself, but I've seen a lot of people also use this:

"workspaces": { "nohoist": [ "@tailwindcss/forms", "@tailwindcss/forms/**" ] },

@RobinMalfait RobinMalfait merged commit abdd1d4 into master Feb 26, 2021
@RobinMalfait RobinMalfait deleted the tailwindcss-peer-dependency branch February 26, 2021 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot find module 'tailwindcss/plugin'
1 participant