-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Extract license info outside of the JavaScript bundle #17892
Comments
Start a new pull request in StackBlitz Codeflow. |
I think esbuild is preserving import { defineConfig } from 'vite';
export default defineConfig({
esbuild: {
legalComments: 'none',
},
}); Probably what you want is Not sure but maybe you can try other plugins to get back the licenses separately not from the code comment? something like https://github.com/mjeanroy/rollup-plugin-license |
okay |
I'm personally inclined to mark this as an enhancement since it would be a nice default for Vite to auto manage and emit licenses when building apps. |
Description
This is something between a bug and a feature I guess, but I notice that my JS bundle contains a lot of similar license code comments.
Sample: https://stackblitz.com/edit/vitejs-vite-k6vbhh?file=dist%2Fassets%2Findex-trimmed.js
After removing these with
uglify-js
I see about 20% file size decrease.While these licenses are important, my average website visitor won't really bat an eye about this.
Suggested solution
I'm wondering if Vite could extract all the comments and place them into a
license.txt
file and link that in my bundled.js instead.Alternative
I guess I can do post processing myself to deal with this.
Additional context
The
firebase
package does seem to bring a lot of very similar Google licenses. So you only have this problem based on what packages you use.Validations
The text was updated successfully, but these errors were encountered: