-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
[code-infra] Remove "main" fields from publishable packages #46856
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
Conversation
Netlify deploy previewhttps://deploy-preview-46856--material-ui.netlify.app/ Bundle size report
|
5661fb3 to
a33fdc5
Compare
| @@ -0,0 +1,71 @@ | |||
| { | |||
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.
Reasons for keeping it -
code-infra buildcommand is run which also generatespackage.jsonwith modifiedexportsandmainfields. If we don't keep this file, there is no way to just generate this file with the build command.esm/package.jsonis not deleted explicitly which otherwise results in errors withpnpm test:karma, specifically webpack complaining about the missingrequire.- Keeping this file as
package.jsonmakes this a package which then creates issues withnext buildof the docs since all files inside this folder are assumed as commonjs andnexttries to load something insideesm/and encounteringimport/export.
One downside is that this file gets generated only once in a while when someone runs build:lib:clean manually. This also lies outside of renovate resulting in not updating of package versions.
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.
I've added a script to mitigate this which essentially copies exports, main and other path fields from this file to the original package.json and writes to the build dir.
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.
I have removed the changes in @mui/icons-material from this PR. I'll refactor some of the build process of the package in a separate PR since that had a lot of changes unrelated to this PR.
eac7527 to
b35fae8
Compare
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.
Love this, moving towards making exports the single source of truth
Also some refactor in @mui/icons-material packages. Keeping the generated package.json files in the lib directory and updated the create-typings script to add "types" field.
b35fae8 to
3063b9d
Compare
Skipping the check in
@mui/icons-materialsince it needs some extra refactor which I'll open as a separate PR.