⚠️ This project is now archived. You should use Vite with the Preact preset instead. ⚠️
npm i -D cra-preact
# or
yarn add --dev cra-preact
Write your code as if you weren't using preact
, continue importing react
.
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.
While rare, problems may occur.
cra-preact
is using preact's compatibility layer (preact/compat
) and issues with it should be directed to preact's repocra-preact
to catch incompatibilities during developmentreact-scripts
any minor upgrade of it might be a breaking change for cra-preact
npm link
and npm install
don't respect peer dependenciesThis whole project was inspired by this github comment.