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

Drop @tailwindcss/line-clamp warning #10915

Merged
merged 2 commits into from
Mar 30, 2023
Merged

Drop @tailwindcss/line-clamp warning #10915

merged 2 commits into from
Mar 30, 2023

Conversation

RobinMalfait
Copy link
Contributor

@RobinMalfait RobinMalfait commented Mar 30, 2023

This PR fixes an issue where applications could break when using the new Tailwind CSS v3.3.0 version.

This happens because we're trying to detect whether or not the @tailwindcss/line-clamp plugin is being used by conditionally requiring it. This is done because the line-clamp plugin is now part of Tailwind CSS itself, and so the plugin is no longer required.

Unfortunately some build tools hoist conditional require calls as static imports, even if they are inside of a try/catch block, causing build failures when the @tailwindcss/line-clamp package is not installed.

To solve this we removed this warning from Tailwind CSS and are instead including it in the latest patch version of the @tailwindcss/line-clamp plugin (tailwindlabs/tailwindcss-line-clamp#26).

Unfortunately this means that, unless the user updates to the latest version of the @tailwindcss/line-clamp plugin, we can no longer automatically disable the line-clamp plugin — which could result in having duplicated CSS entries for the line-clamp utilities. The good news is that this doesn't actually break your UI, it just results in a bit of extra CSS in the final output.

Fixes: #10894

This won't work in places where `require` calls are hoisted so that
they become static imports. This means that in some projects this
`require` call was breaking the full application even though it was
intentionally put in a try/catch block...
@RobinMalfait RobinMalfait changed the base branch from master to 3.3 March 30, 2023 16:17
@RobinMalfait RobinMalfait merged commit 9cd0301 into 3.3 Mar 30, 2023
@RobinMalfait RobinMalfait deleted the fix/issue-10894 branch March 30, 2023 16:42
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.

@tailwindcss/line-clamp check produces an error if bundled.
1 participant