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

chore: Reduce production bundle sizes #7977

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

devongovett
Copy link
Member

This reduces production bundle sizes for our libraries by making some parts of the code gated behind process.env.NODE_ENV checks. This is now possible as of Parcel v2.14.0: parcel-bundler/parcel#10102 In particular, console warnings and errors now only appear in development, and will be compiled away in production apps to avoid including those strings.

Also, some fallback code in usePress, useHover, useMove, etc. for environments that don't support pointer events is now only included when NODE_ENV === 'test'. These branches are not used in any real browser because all browsers have supported pointer events for a while now, but JSDOM still does not support them, so we need to keep this code to avoid breaking everyone's tests. However, omitting them in browser builds should be safe and cuts the bundle size of these hooks in half.

@rspbot
Copy link

rspbot commented Mar 22, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants