Skip to content

fix: tell vite not to optimize clsx #1113

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

Closed
wants to merge 1 commit into from
Closed

Conversation

dominikg
Copy link
Member

alternative to #1067

clsx has a single file esm export so does not benefit from being optimized. In theory vite can do better itself here but to help svelte users experiencing this behavior we can add it to optimizeDeps.exclude. This works well even for svelte versions that do not use clsx and requires minimal code change.

Users who want clsx "optimized" can put it in optimizeDeps.include to force it - which will also prevent the dev server restart.

@dominikg
Copy link
Member Author

well, vite import analysis didn't like this at all 🙈

@dominikg dominikg closed this Apr 22, 2025
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.

1 participant