You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Make it PURE and keep comments in the bundle// bundlers understand and keep PURE annotations anyway from my experienceconstDialogOverlay=/* @__PURE__ */React.forwardRef<DialogOverlayElement,DialogOverlayProps>((props: ScopedProps<DialogOverlayProps>,forwardedRef)=>{constportalContext=usePortalContext(OVERLAY_NAME,props.__scopeDialog);const{ forceMount =portalContext.forceMount, ...overlayProps}=props;constcontext=useDialogContext(OVERLAY_NAME,props.__scopeDialog);returncontext.modal ? (<Presencepresent={forceMount||context.open}><DialogOverlayImpl{...overlayProps}ref={forwardedRef}/></Presence>) : null;});
Expected behavior
Unused components should be removed from the bundle.
Make forwardRef components pure with a comment /* @__PURE__ */ forwardRef(...).
Make Component.displayName = conditional for components to be removed.
Additional context
Issue #336 with PR #577 fixed tree-shaking in 2021. However, this was reverted later, and I don't know why.
In my repository, after bundling the UI and the Vite App (See the README), you can see the Dialogs reference (DialogPortal for example) in the final bundle because esbuild cannot understand the Dialog could be removed because there is no PURE annotations or displayName is used.
Your environment
The text was updated successfully, but these errors were encountered:
Bug report
Current Behavior
Tree-shaking is not optimized/not working.
Current components are not using PURE annotation or is using displayName that cause tree-shaking problems.
Current Dialog component
Easy first solution to do
Expected behavior
Unused components should be removed from the bundle.
Reproducible example
Repository
Suggested solution
/* @__PURE__ */ forwardRef(...)
.Component.displayName =
conditional for components to be removed.Additional context
Issue #336 with PR #577 fixed tree-shaking in 2021. However, this was reverted later, and I don't know why.
In my repository, after bundling the UI and the Vite App (See the README), you can see the Dialogs reference (DialogPortal for example) in the final bundle because esbuild cannot understand the Dialog could be removed because there is no PURE annotations or displayName is used.
Your environment
The text was updated successfully, but these errors were encountered: