-
-
Notifications
You must be signed in to change notification settings - Fork 15
Reduce built library size #277
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
✅ Deploy Preview for anchor-position-wpt canceled.
|
✅ Deploy Preview for anchor-polyfill ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
vite.config.ts
Outdated
| external: [/source-map-js/], | ||
| }, | ||
| }, | ||
| plugins: [bundleStats()], |
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.
Because we have multiple outputs, this is just giving us the stats for the last build, but I don't think there's a benefit for auditing the builds separately.
I'm leaning towards leaving this installed, as it can help us keep an eye on the bundle size.
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.
Makes sense. I moved it to devDependencies and made it less verbose, but the generated reports are still there.
| target: 'es6', | ||
| sourcemap: true, | ||
| rollupOptions: { | ||
| external: [/source-map-js/], |
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.
Do we need to provide a name in output.globals? There's a warning message emitted-
`No name was provided for external module "source-map-js/lib/source-map-generator.js" in "output.globals". We don't really need to expose it, I don't think?
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.
Yeah, I don't think it really matters. I added it just to silence the warning, since I don't love getting used to "ignore these warnings" if we don't have to.
Description
This reduces the size of the built library from 223.72KiB to 105.54KiB by:
source-map-jsfrom the built library. Source maps are still generated, but the module itself isn't needed.Pre-merge cleanup:
Related Issue(s)
#276
Steps to test/reproduce
import polyfill from '/dist/css-anchor-positioning-fn.js';npm run build; open dist/bundle-stats.htmlto check the results. (You can compare with the current build on theprev-statsbranch, which has the bundle-stats plugin installed with no modifications to main.Show me
Before

After
