Allow specifying assumptions in @vitejs/plugin-legacy
#6965
Description
Clear and concise description of the problem
Babel allows specifying compiler assumptions for smaller code output, see https://babeljs.io/docs/en/assumptions.
However, @vitejs/plugin-legacy
doesn't allow these options to be enabled.
Suggested solution
Add an option called assumptions
and pass it to Babel.
I noticed this in the contributing guildlines:
Think before adding yet another option
We already have many config options, and we should avoid fixing an issue by adding yet another one. Before adding an option, try to think about:
I think it's ok here since @vitejs/plugin-legacy
doesn't have too many options right now.
Whether the problem is really worth addressing
Yes, this option could significantly reduce output size
Whether the problem can be fixed with a smarter default
Possibly...we could set the assumptions
to those that work well with Vite but that might not work with users' code.
Whether the problem has workaround using existing options
No.
Whether the problem can be addressed with a plugin instead
No.
Alternative
No response
Additional context
I'd be willing to make a PR for this except I am not familliar with Jest nor pnpm.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.