-
-
Notifications
You must be signed in to change notification settings - Fork 123
[code-infra] Add bundle size monitor #1791
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
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Bundle size report🚫 No bundle size snapshot found for base commit d27e8c2. Total Size Change: +1.34MB(0.00%) - Total Gzip Change: +455KB(0.00%) @base-ui-components/react parsed: Show 30 more bundle changes@base-ui-components/react/tabs parsed: |
commit: |
For #201 |
Oh, and mind you that I updated it to allow for arbitrary code if you want to check something custom: // bundle-size/bundle-size-checker.config.mjs
{
id: 'custom-entry',
code: `
import { Field } from '@base-ui-components/react/field';
console.log(Field.Root, Field.Label);
`,
externals,
}, (Doesn't accept jsx yet I just noticed, but will look into that) |
return { | ||
id: entrypoint, | ||
import: entrypoint, | ||
externals, |
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.
This is unnecessary if @base-ui-components/react
adds an export condition for ./package.json
. Then we can just return entrypoint
from this function and the bundle size monitor will infer the externals from the peer dependencies. Right now it has no real way to find the package.json location reliably for a module. (besides using a custom resolver)
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 don't mind exporting package.json. Can you do it in this PR or prefer me to open a new one?
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.
had it before in this PR, will bring it back.
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 seen that many packages adopted this convention, it will become obsolete though once findPackageJSON
becomes more stable
I checked https://bundlephobia.com/package/@base-ui-components/[email protected] and it shows drastically different values. Do you have any idea where this difference might come from? |
Porting the bundle size monitor from core. This establishes a baseline. This bundles each entrypoint with its dependencies. Bundles are stored in S3 for comparison. Peer dependencies are ignored. To inspect the created bundles run
examples: