|
First of all, thank you for saving my project from the time drain that is webpack! 😉 One thing webpacker does right, is that it outputs a .gz and a .br compressed copy of every precompiled asset (excluding fonts and images), which is a very nice batteries included-type feature. Vite doesn't do this on its own. There are currently two plugins that aim to help, but they don't really work due to recent changes in vite. But isn't it probably just as good to give the task to this gem, i.e. rake (or EDIT: I just realised browsing the webpacker source code that the compression is done by webpack and not rake. So that might pose a problem? Honestly I'm surprised vite doesn't offer this option as default. |
Replies: 1 comment 4 replies
|
Hi @evenreven! Compressing assets at build time is not as relevant as in the past—many CDNs and edge services will automatically serve compressed assets. This is why the feature is not in core Vite.js, it would unnecessarily increase the bundle size and build size for something most users will already get from their hosting providers. If you still need this behavior, there are good news though 😃 Since Vite.js is built on top of Rollup, plugins such as There's also Check out the |
Hi @evenreven!
Compressing assets at build time is not as relevant as in the past—many CDNs and edge services will automatically serve compressed assets.
This is why the feature is not in core Vite.js, it would unnecessarily increase the bundle size and build size for something most users will already get from their hosting providers.
If you still need this behavior, there are good news though 😃
Since Vite.js is built on top of Rollup, plugins such as
rollup-plugin-brotliandrollup-plugin-gzipwork out of the box.You may combine them to generate both
gzandbrversions of each asset, or addrollup-plugin-gziponce per format.There's also
vite-plugin-compress, but it compresses files i…