Getting Started
This blog post will explain how you can easily add Preact to your Next.js application to reduce Next.js' bundle size.
Note: Preact isn't compatible with Next.js App Directory. Next.js App Directory serves less client-side JavaScript by default.
Preact installation
Preact can be easily installed with the following command:
Next.js configuration
To enable Preact, we must edit our Next config.
Usage
Once you build your Next.js application, you should see a decrease in bundle size. Below you can see the results on my site.
That's it
Yes, that's it! It's super easy 🚀!