-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[charts] Use ESM with imports #9645
Conversation
Netlify deploy previewNetlify deploy preview: https://deploy-preview-9645--material-ui-x.netlify.app/ Updated pagesNo updates. These are the results for the performance tests:
|
@Janpot I think I found an intermediate solution by using the following config in the If I'm correct devs using the "exports": {
".": {
"require": "./index.js",
"import": "./esm/index.js"
},
"./*": {
"require": "./*",
"import": "./esm/*"
}
}, |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
I believe this would implement proposed strategy 2 from mui/material-ui#37335. I find it difficult to take a stance on which strategy to follow as any of them will have an impact on some of our users. My personal preference though would be that we follow the same strategy throughout all MUI packages that need to interoperate as to maximize the probability of them working together successfully in our users wide range of standards compliant and less-compliant setups. As an example, the icons package deviates from our regular strategy and I keep running into problems with bundlers misinterpreting it. I'm not against this PR, I think I'd slightly prefer more that we just not externalize the |
I did not succeed in bundling the From the toolpad codebase I saw you used the And I'm confused because the webpack |
Oh right, I see, we are not bundling at all, we're just transforming our input files. I'm sorry, that makes my suggestion a bit harder than I expected. I believe we have roughly the same options as described by https://formidable.com/blog/2022/victory-esm/. It's either becoming ESM-only or vendoring in d3. (unless not using d3 is also an option 🙂 ) (cc @mui/code-infra thoughts?) |
As Charts are not stable yet, I believe we may use this package to verify the solution regarding ESM. If it proves to be painless for the community, we'll be more certain it won't cause major problems when eventually other packages follow the same pattern. |
I have tried to prefix all the issues we have about publishing JavaScript to the best possible format with Good luck https://blog.isquaredsoftware.com/2023/08/esm-modernization-lessons/ 😅 |
Iterate on #9556