You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on what I was seeing in #175 trying to get the bundles to work; I couldn't properly get the chunks working as I ideally wanted where each entry point would be bundled up with no chunks except for a vendor chunk that included hydrogen-view-sdk
And I know the current chunking makes entry-client-room-alias-hash-redirect.js inefficient by just making it small and pulling in a separate redirect-if-room-alias-in-hash chunk which seems completely unnecessary and could be bundled into itself without an extra import.
Any combination of manualChunks and experimentalMinChunkSize options I tried with Vite just didn't do the trick.
- Rename `public` -> `client` so it doesn't get copied automagically as-is (without hashes which we want for cache busting), https://vitejs.dev/guide/assets.html#the-public-directory
- We still build the version files to `public/` so their copied as-is and Vite handles it for us (so we can use `emptyOutDir`)
- Use a multiple entrypoint `.js` Vite build so things can be more intelligently bundled and take less time
- We aren't using library mode because it doesn't minify or bundle assets
- Using hash asset tags for cache busting. Hash of the file included in the file name
- We lookup these hashed assets from `manifest.json` that Vite builds (https://vitejs.dev/guide/backend-integration.html) to serve and preload
- In terms of optimized bundles, I know the current output isn't great now but will have to opt to fix that up separately in the future. Tracked by #176
Reduce unused JavaScript and defer loading scripts until they are required to decrease bytes consumed by network activity. Learn how to reduce unused JavaScript. LCP
Related to #132
Bundle efficiency
Based on what I was seeing in #175 trying to get the bundles to work; I couldn't properly get the chunks working as I ideally wanted where each entry point would be bundled up with no chunks except for a
vendor
chunk that includedhydrogen-view-sdk
And I know the current chunking makes
entry-client-room-alias-hash-redirect.js
inefficient by just making it small and pulling in a separateredirect-if-room-alias-in-hash
chunk which seems completely unnecessary and could be bundled into itself without an extra import.Any combination of
manualChunks
andexperimentalMinChunkSize
options I tried with Vite just didn't do the trick.Also see https://vitejs.dev/guide/build.html#chunking-strategy
Bundle size
The bundles seem pretty big at the moment and there is probably lots of opportunity to prune things down. Are we even tree-shaking?
Hopefully in #175, we figure out how to minify the JS.
Dev notes
A way to visualize JS bundles:
The text was updated successfully, but these errors were encountered: