Hacking create-react-app to work with Preact & LESS without ejecting
- Preact is better at living together with external libraries and Custom Elements than React,
- Preact is smaller, even when adding
preact-compat
(React vs Preact), - Preact's codebase is small enough to read in a single sitting,
- Preact didn't have license issues,
- We didn't want to
eject
and lose getting updates toreact-scripts
, - We didn't want to change to another bootstrap framework or write our own,
- My cat told me to do it.
I broke the hack down to 5 steps and you can view them as Pull Requests here in this repo:
We bootstrap our repo with create-react-app
This is the hack itself, we trick create-react-app
into using preact
by aliasing all the related modules.
We don't need to support IE9 or IE10, let's not build for them either!
Time to pre-process LESS
into CSS
.
This is how you can add extra webpack
plugins.
PS: My team working on Tradeshift UI Components is hiring!