-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Workaround RSP tree shaking issue with RAC #6301
Conversation
export const ColorFieldContext = createContext<ContextValue<ColorFieldProps, HTMLDivElement>>(null); | ||
export const ColorSliderContext = createContext<ContextValue<Partial<ColorSliderProps>, HTMLDivElement>>(null); | ||
export const ColorWheelContext = createContext<ContextValue<Partial<ColorWheelProps>, HTMLDivElement>>(null); | ||
export const HeadingContext = createContext<ContextValue<HeadingProps, HTMLHeadingElement>>({}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most optimal thing to do would be to make each of these a separate file but that seemed a bit annoying. So if you import Checkbox you'll currently also get the other contexts, but they are tiny (one function call) so doesn't seem like a big deal.
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
## API Changes
unknown top level export { type: 'any' } |
This avoids all of RAC Checkbox and its dependencies being included in RSP checkbox when building an app with Parcel. The underlying issue is a bug in SWC, the minifier used by Parcel. In the meantime, this workaround moves the contexts we import from RSP when not using the RAC implementation to a separate file so that only the contexts are included and not the entire implementation. I verified this is working in a test app.