Skip to content

Do not scan tailwind-merge sources for candidates#16005

Merged
philipp-spiess merged 6 commits into
mainfrom
fix/vite-tailwind-merge
Jan 29, 2025
Merged

Do not scan tailwind-merge sources for candidates#16005
philipp-spiess merged 6 commits into
mainfrom
fix/vite-tailwind-merge

Conversation

@philipp-spiess

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

Copy link
Copy Markdown
Contributor

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

@RobinMalfait RobinMalfait left a comment

Copy link
Copy Markdown
Member

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.

Comment thread playgrounds/vite/src/app.tsx Outdated
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