-
Notifications
You must be signed in to change notification settings - Fork 67
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
Compound component (e.g., Form.Group
, SearchField.Advanced
) exports include entire module in Webpack bundles
#2425
Comments
Form.Group
, SearchField.Advanced
) exports bringing in entire module
Form.Group
, SearchField.Advanced
) exports bringing in entire moduleForm.Group
, SearchField.Advanced
) exports include entire module in Webpack bundles
Thanks for the report of this issue, @ochavarria2u! We'll need to decide what we want to do to mitigate these bundle size impacts across Paragon's consuming repos in a reasonable way. For example, is there any workaround to keep compound components ( |
Hey, @ochavarria2u, thanks for reporting this! The root problem was that our icons package did not support tree-shaking at all, which resulted in all of the icons being included into the initial bundle if your code used at least one of the icons. That's what happened in your first example - Note however that this only caused size problems for the initial bundle size ( I'm not sure why your first example reports 0B for parsed and gzipped sizes though, I believe that means that none of paragon code got into the final bundle, which is really strange. When I tried to reproduce your example this is what I got Could you maybe provide a bit more context on the first example, e.g. how did you use |
Hi @viktorrusakov thanks for the fix, I've been fetching the reports and it seems that the bundle size got reduced by 150mb. Checking our reports it seems that the parsed size and gzipped size is still 0. I belief this is the reason why. I'm seeing that some of the parents aren't supporting treeshake so we can only do compound components, do you have plans on doing it ? Here's some componenets I've identify that could use the change. import { SearchField } from '@edx/paragon'; FYI - Here's how we use the reports: |
@ochavarria2u I don't think these component would affect the bundle very much as they only include related compound components (which shouldn't take too much space) into the bundle and not the whole Paragon. However, I understand that it is still an issue and we do plan to fix them. I've created a separate issue #2464 to track progress on migrating off of compound components in Paragon. I'm pretty sure there is no way to support tree-shaking for them, so we just have to remove them and instead only use standalone components. I'm not sure when this will be done though, I'd like to hear @adamstankiewicz's thoughts here also. |
@ochavarria2u @viktorrusakov I agree, it appears that compound components (e.g., I think the first step here should be to evaluate whether all Paragon's compound components have an associated standalone component export (e.g., If we have Then, tackling what's proposed in #2464 makes sense. We should definitely deprecate the compound components (perhaps even with a legit DEPR ticket, which I'd be happy to file) first with adequate warning for consumers. @viktorrusakov I'll add some thoughts to this effect to #2464. tl;dr; For the purpose of this issue, we should confirm that all compound components do indeed have an associated standalone components exported already to ensure consumers have a path forward today to mitigate these concerns, and perhaps update the Paragon README about tree shaking to mention lack of support for it with compound components: https://github.com/openedx/paragon#treeshaking |
Moving conversation to #2464 |
Hello team, making some investigation I found that some of your imports bundles the entire lib, and the tree shacking is not working. Here's an example of search vs container.
|Search field:
Container:
I already validated this with @adamstankiewicz, so please let me know if there's anything I can do in order to help with this issue.
The text was updated successfully, but these errors were encountered: