Sometimes you want to push bundle size down as far as possible for a project that is not meant for public distribution.
In that case, removing license comments can shave a little size off the output.
Remove legalComments
esbuild has a legalComments option. Setting it to none stops license comments from being emitted.
If you are using Vite, configure it like this.
export default defineConfig({ esbuild: { legalComments: "none" }})That removes the license comments during the build.
Caution
If you remove license comments, you may fail to satisfy OSS license notice requirements.
Be careful with this in public projects or commercial use.
Treat it as an option for internal tools or personal projects where bundle size matters more.
Summary
Using esbuild’s legalComments: "none" lets you remove license comments and trim bundle size.
Just make sure you consider the trade-off with license notice obligations before using it.
hsb.horse