Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

nextjs-preact-demo

> 编程语言
Open source

Next.js 9.3 + Preact = 21kB

381 stars0 likes2 views
WebsiteGitHub

About

Next.js 9.3 + Preact = 21kB

Preact example

This is a fully working example of Next.js 9.5 running on Preact instead of React.

This reduces the base JavaScript weight of pages to ~22kB.

In the future, this can be even smaller with some additional Webpack optimizations.

How to use

Clone this repo and run npm install:

bash
git clone https://github.com/developit/nextjs-preact-demo.git
cd nextjs-preact-demo
npm install

There are three commands available:

bash
# start a development server:
npm run dev

# create a production build:
npm run build

# start a production server:
npm start

How does it work?

The example takes advantage of npm/yarn aliases, which essentially allow installing preact/compat at node_modules/react.

Here's how this example repo was set up:

  • Set up a basic Next.js app using create-next-app
  • Install preact, uninstall react and react-dom.
  • Install preact-compat/react and preact-compat/react-dom for aliasing.
  • Use an npm alias to replace react-ssr-prepass with preact-ssr-prepass (also works with Yarn).

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言