🏗🏗🏗 Work in progress 🏗🏗🏗
pnpm serve
pnpm prebuild
pnpm build:server
# or
pnpm build:client
pnpm build
pnpm format
pnpm lint
- express + static: ~1.5mb
- fastify + @fastify/static: ~750kb
- @tinyhttp/app + sirv: ~220kb
NOTE: Unfortunately, this table doesn't contains benches for tinyhttp
Choose your fighter ¯\_(ツ)_/¯
There are two main entry points in the src
folder: client
and server
src/
├── app
│ ├── \_template
│ │ └── base.tsx
│ ├── app.routing.tsx
│ └── app.tsx
├── client.tsx // 1
└── server.tsx // 2
client.tsx
entry useshydrate
function to bypass most rendering work when loading in the browser. Otherwise it's just your react projectindex.tsx
.server.tsx
entry contains server which:- Serves static assets via
sirv
- Maps application
routes
to the server routes. - Renders components via
renderToString
and template from_templates
.
- Serves static assets via
With the new jsx transform you don't need to import React in every file where you want to use jsx. With esbuild you could inject import React from 'react'
in file using re-export a.k.a shim. Think about it as workaround that helps expose built-in API during build.
You could move app.routing.tsx
to the App component like this.