Preact: Preact is actually larger than React itself?

Created on 10 Feb 2020  路  2Comments  路  Source: preactjs/preact

Perhaps I'm missing something, but it seems Preact is alot heavier than React in terms of bytes?

https://unpkg.com/browse/[email protected]/dist/ - Production minified 9.3kB
https://unpkg.com/browse/[email protected]/cjs/ - Production minified 6.64 kB

Most helpful comment

For React you also have to include: https://unpkg.com/browse/[email protected]/cjs/ since both are needed to make an application.

The best way is to compare gzip sizes:

And here's Preact:

All 2 comments

For React you also have to include: https://unpkg.com/browse/[email protected]/cjs/ since both are needed to make an application.

The best way is to compare gzip sizes:

And here's Preact:

As @JoviDeCroock said you need to take react-dom into account. The react package itself contains just the reconciler and no logic on how to render into the web. That's what react-dom comes into play. Preact is basically react + react-dom combined.

Here are the current sizes for the lazy:

| Framework | Size (min+gzip) |
|---|---|
| React + ReactDOM | 38.8kB (2.6kB + 36.2kB) |
| Preact | 3.6kB |

Was this page helpful?
0 / 5 - 0 ratings