shilangyu / cra-preact

Comfort of CRA + preact without ejecting 🔥
MIT License
27 stars 3 forks source link
cra cra-preact crea-react-app no-ejecting preact rewired smaller-cra

⚠️ This project is now archived. You should use Vite with the Preact preset instead. ⚠️

create react app + preact = 💖

Love the CRA bootstrap? Hate big bundle sizes?

npm i -D cra-preact
# or
yarn add --dev cra-preact

Write your code as if you weren't using preact, continue importing react.

usage

Replace your build, start and test scripts

"scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test",
+ "start": "cra-preact start",
+ "build": "cra-preact build",
+ "test": "cra-preact test",
  "eject": "react-scripts eject"
}

Cool, done. Now watch the bundle size go down.

bundle size drop porn

initial CRA bootstrap

initial app

medium size real-world production project

middle size

disclaimer

While rare, problems may occur.


This whole project was inspired by this github comment.