feat(preview): allow setting compression options#20612
feat(preview): allow setting compression options#20612valadaptive wants to merge 1 commit intovitejs:mainfrom
Conversation
|
We usually try to avoid adding new options to not make the config too complex. Is there a specific option you're looking to toggle that we could do by default instead? |
|
If you'd prefer not to add compression options, you could just enable compressing WebAssembly files in the dev server (it may be worth going through and checking what has |
|
Yeah I think that's reasonable to add. Maybe also worth upstreaming this to We're currently using mrmime which doesn't have compressible data to use, but perhaps a manual test/check with mime-db locally with the regex is enough here. I skim through mime-db and it seems like the regex already covers most. |
|
Upstream PR: lukeed/polka#222 |
Description
I noticed that the
@polka/compressionmiddleware doesn't compress WebAssembly files. While I intend to fix this upstream in@polka/compressionitself, I think it's worth exposing the compression middleware options in Vite itself. I find the preview server useful for (roughly) profiling how long my application will take to load on slow connections, and hosts like GitHub Pages do compress WebAssembly.I hope re-exporting the interface directly from
@polka/compressionisn't an issue--it seems to be done with the HTTP proxy options as well.I can't seem to find the tests for the preview server--let me know what I should base the tests off of.