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

Wrong bundled file? #307

Closed
puskin94 opened this issue Sep 5, 2023 · 2 comments
Closed

Wrong bundled file? #307

puskin94 opened this issue Sep 5, 2023 · 2 comments
Labels
context-v1 Related to tailwind-merge v1

Comments

@puskin94
Copy link

puskin94 commented Sep 5, 2023

Describe the bug

creating the production bundle with vitejs and inspecting the resulting bundle, I see the dist/lib/default-config.mjs file bundled, not the tailwind-merge.cjs.production.min.js one

Environment

  • tailwind-merge version: 1.14.0

Additional context

I don't know if this is intended , but inspecting the bundle I would think the compressed and minified tailwind-merge.cjs.production.min.js file would be used instead of the other one.

@dcastil
Copy link
Owner

dcastil commented Sep 17, 2023

Hey @puskin94! 👋

This is intended. The tailwind-merge.cjs.production.min.js is for Node.js projects that use CommonJS and don't bundle and minify their code. When you use Vite, the ESM version of the library code gets loaded (which is not minified) as this is the standard for browsers. I kept the ESM version unminified to get better error reporting in dev-mode (where code stays unminified) if something goes wrong and because frontend bundlers, including Vite, usually minify the code automatically when producing a production build, so the tailwind-merge code gets minified anyway.

By the way, I'll remove the minified tailwind-merge.cjs.production.min.js file in an upcoming v2 release. You can read about the reasons for that here: #283 (comment)

PS: Thanks for your patience, I'm just coming back from a vacation.

@dcastil dcastil added the context-v1 Related to tailwind-merge v1 label Oct 30, 2023
@dcastil
Copy link
Owner

dcastil commented Dec 20, 2023

Closing this issue for inactivity. @puskin94 let me know in case I should reopen in again.

@dcastil dcastil closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context-v1 Related to tailwind-merge v1
Projects
None yet
Development

No branches or pull requests

2 participants