Skip to content

Conversation

@brijeshb42
Copy link
Contributor

@brijeshb42 brijeshb42 commented Sep 2, 2025

Skipping the check in @mui/icons-material since it needs some extra refactor which I'll open as a separate PR.

@brijeshb42 brijeshb42 added the scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). label Sep 2, 2025
@brijeshb42 brijeshb42 changed the title [infra] Remove all "main" fields from publishable packages [infra] Remove "main" fields from publishable packages Sep 2, 2025
@mui-bot
Copy link

mui-bot commented Sep 2, 2025

Netlify deploy preview

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

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 3063b9d

@brijeshb42 brijeshb42 force-pushed the remove-main-field branch 3 times, most recently from 5661fb3 to a33fdc5 Compare September 2, 2025 14:15
@@ -0,0 +1,71 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reasons for keeping it -

  1. code-infra build command is run which also generates package.json with modified exports and main fields. If we don't keep this file, there is no way to just generate this file with the build command.
  2. esm/package.json is not deleted explicitly which otherwise results in errors with pnpm test:karma, specifically webpack complaining about the missing require.
  3. Keeping this file as package.json makes this a package which then creates issues with next build of the docs since all files inside this folder are assumed as commonjs and next tries to load something inside esm/ and encountering import/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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Member

@Janpot Janpot left a 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

@brijeshb42 brijeshb42 requested a review from a team September 3, 2025 14:46
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.
@brijeshb42 brijeshb42 enabled auto-merge (squash) September 3, 2025 15:35
@brijeshb42 brijeshb42 merged commit fe8ec9e into mui:master Sep 3, 2025
18 checks passed
@brijeshb42 brijeshb42 deleted the remove-main-field branch September 3, 2025 15:50
@zannager zannager changed the title [infra] Remove "main" fields from publishable packages [code-infra] Remove "main" fields from publishable packages Sep 4, 2025
@oliviertassinari oliviertassinari added the scope: icons Changes related to the icons. label Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: code-infra Involves the code-infra product (https://www.notion.so/mui-org/5562c14178aa42af97bc1fa5114000cd). scope: icons Changes related to the icons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants