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

[utils] Allow nested imports in @mui/utils to speed up build #37586

Merged

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jun 14, 2023

Part of #35840

See mui/mui-x#9172 for context
I also took the opportunity to migrate some files to TS

One step toward #35840

@flaviendelangle flaviendelangle added the package: utils (private) Specific to the private @mui/utils package label Jun 14, 2023
@flaviendelangle flaviendelangle self-assigned this Jun 14, 2023
@mui-bot
Copy link

mui-bot commented Jun 14, 2023

Netlify deploy preview

https://deploy-preview-37586--material-ui.netlify.app/

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against a78c098

Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@oliviertassinari oliviertassinari changed the title [utils] Allow nested imports for MUI-X [utils] Allow nested imports in @mui/utils to speed up build Jun 14, 2023
@flaviendelangle flaviendelangle merged commit 163ada4 into mui:master Jun 15, 2023
19 checks passed
@flaviendelangle flaviendelangle deleted the allow-nested-import-mui-utils branch June 15, 2023 06:46
@NMinhNguyen
Copy link
Contributor

@flaviendelangle previously, a lot of the exports had the unstable_ prefix but with the way the files/folders are after this PR it’s possible to import @mui/utils/useEventCallback without the unstable_ prefix - is that a concern?

@flaviendelangle
Copy link
Member Author

Do you have an import from the same endpoint that has changed?
Or is it just on the new endpoints (@mui/utils/useEventCallback for example) that you don't have the unstable_ prefix?
If so, maybe @michaldudak can give his point of view 👍

@michaldudak
Copy link
Member

IMO we should discourage developers from importing from @mui/utils directly and treat this as an internal package. Individual functions that could be made public should be reexported from other packages.

@NMinhNguyen
Copy link
Contributor

Or is it just on the new endpoints (@mui/utils/useEventCallback for example) that you don't have the unstable_ prefix?

This :) what I mean is that in index.js there is aliasing happening that re-exports some of the utils with that prefix, but the nested imports don’t follow that convention currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: utils (private) Specific to the private @mui/utils package performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants