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

Do not scan tailwind-merge sources for candidates #16005

Merged
merged 6 commits into from
Jan 29, 2025

Conversation

philipp-spiess
Copy link
Member

@philipp-spiess philipp-spiess commented Jan 29, 2025

Resolves #15722

This PR adds a list of ignored dependencies (in the current form only tailwind-merge) to the Vite extension which, when included in the dependency tree, are no longer scanned by the Tailwind CSS compiler for candidates. This is to work around an issue where some dependencies contain vast lists of valid Tailwind CSS class names which would otherwise always be inlined in the build.

Test plan

This was tested in our Vite playground on both dev and prod builds across macOS and Windows:

Windows prod build before

telegram-cloud-photo-size-4-5823632138052944949-y

Windows prod build after

This includes a debug console.log(…) to make sure it matches the right module.

telegram-cloud-photo-size-4-5823632138052944951-y

Windows dev build after

This includes a debug console.log(…) to make sure it matches the right module.

telegram-cloud-photo-size-4-5823632138052944948-y

@philipp-spiess philipp-spiess requested a review from a team as a code owner January 29, 2025 13:57
Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add an integration test to ensure this works as expected (and keeps working in the future)?

Otherwise, I like it.

playgrounds/vite/src/app.tsx Outdated Show resolved Hide resolved
@philipp-spiess philipp-spiess merged commit a4761ea into main Jan 29, 2025
5 checks passed
@philipp-spiess philipp-spiess deleted the fix/vite-tailwind-merge branch January 29, 2025 16:32
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.

[v4] CSS bundle bloated when using @tailwindcss/vite and tailwind-merge
2 participants