-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Bundle size improvements #1246
Comments
@atomiks What logic is left in production?
Did you mean What I anticipate to be great DX is for us to have our own custom prop-types package: mui/material-ui#43138.
@Janpot recently iterated on this, helping a bit bring this in Base UI: mui/material-ui#43904.
👍 related to #454
@romgrk has been doing a lot of changes around this in the data grid. It's a performance killer too. If we want to use this issue as an umbrella, more ideas:
|
Packages that solely rely on TypeScript are the standard in terms of consumption, and prop-types isn't typically expected to exist at all imo
|
I won't have time in the short term. Should you explore it yourself, we seem to do something very similar to what
What likely will need to be done before we can integrate in other projects is a way to make the message configurable so you can host it on your own docs. I was thinking we could just make the module name configurable in the babel plugin. You then have full control on as to where your error formatting happens (e.g. |
Inspecting the production bundle with
create-vite-app
using@base-ui-components/react
reveals some areas of improvement:prop-types
logic is included in the final bundle: Even though.propTypes
assignments are removed in prod, there's some extra code related to it when inspecting the bundle. We should removeprop-types
entirely if possible in the final build, and only use it for documentationmergeReactProps
is used inuseInteractions
, so we should re-createuseInteractions
to use our own version instead of importing it. There is also duplicated logic between our internalComposite
component anduseListNavigation
. There's also a duplicated version ofuseId
Dialog
needlessly includes all anchor positioning logic sinceuseFloating()
brings it in. IfFloatingFocusManager
can acceptfloatingRootContext
object, then that hook won’t need to be used. Importing onlyTooltip
needlessly includes thetabbable
dependency and related focus guard logic sinceFloatingPortal
brings it in. This matters less if you're using multiple components, however, since this logic will be brought in at some point anywayThe text was updated successfully, but these errors were encountered: