material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[code-infra] Build size snapshots from installed packages

Open Janpot opened this issue 1 year ago • 1 comments

Mimic closer how the bundling process would happen at the end-user by creating a "virtual" entrypoint that imports from installed modules. This should result in a more predictable resolution behavior that's closer to what the end-user would experience.

The idea is to:

  • use a virtual module that wildcard imports the module and logs it to avoid tree shaking (this will increase the numbers by a few bytes, but that's fine, it is not part of what we want to measure)
    import * as foo from '<MODULE>'
    console.log('foo')
    
  • let webpack rely on pnpm workspace resolution to resolve imports

Will take care of https://github.com/mui/material-ui/issues/43441 in a separate effort, we would actually want to be able to see the diff for this PR.

This should help with the snapshot issues I'm seeing in https://github.com/mui/material-ui/pull/43264 which is the initial reason for this refactor.

Janpot avatar Aug 26 '24 15:08 Janpot

Netlify deploy preview

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

@material-ui/core/styles/createTheme: parsed: -1.00% :heart_eyes:, gzip: -0.83% :heart_eyes:

Bundle size report

Details of bundle changes (Toolpad) Details of bundle changes

Generated by :no_entry_sign: dangerJS against 7f16724b416c2d1fb81b38c25536b1ddbb8126b1

mui-bot avatar Aug 26 '24 15:08 mui-bot