Skip to content

Commit

Permalink
chore: update bundle size info
Browse files Browse the repository at this point in the history
  • Loading branch information
cyco130 authored Jan 25, 2023
1 parent 81f5ee4 commit e2565a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Rakkas with Preact on the Client

This is the standard Rakkas starter template modified to use `@preact/compat` instead of React, but only on the client. SSR is still done with React on the backend but it's replaced with Preact on the client. The resolver plugin is inlined into [vite.config.ts](./vite.config.ts) and probably can be used in other Vite-based React projects as well.
This is the standard Rakkas starter template modified to use `@preact/compat` instead of React, but only on the client. SSR is still done by React on the backend but hydration is done with Preact on the client. The resolver plugin is inlined into [vite.config.ts](./vite.config.ts) and can probably be used in other Vite-based React projects as well.

Currently, Rakkas's client-side router relies on concurrent Suspense which isn't available in Preact. So the client-side router isn't used: I used plain `a` tags instead of `Link` and reimplemented `StyledLink` in [the main layout](./src/routes/layout.tsx) to not use client-side navigation. We can implement an alternative router for Preact in the future.

This seems like a promising way to reduce the bundle size even further once Rakkas supports islands. The bundle size for each of the three pages in this demo is reduced by 130K compared to the React version (just disable the resolver plugin to see it for yourself).
This seems like a promising way to reduce the bundle size even further once Rakkas supports islands. The bundle size for each of the three pages in this demo is reduced by 120K (from ~190K to ~70K) compared to the React version (just disable the resolver plugin to see it for yourself).

## Try it out

Expand Down

0 comments on commit e2565a3

Please sign in to comment.