e67692006f3bd8a78fbda449f623a597cdc56bd9
App.tsx imported all 24 pages statically, so a first-time visitor downloaded the admin panel, three multiplayer modes and the preset-pair table before the landing page could render - one 682 KB chunk. Every page except Home is now React.lazy behind a Suspense boundary: 56 chunks, pages at 2-11 KB. Verified in a browser against the production build - the landing page fetches only the app and vendor chunks, a navigation fetches that route's chunks and renders, and a deep link into an authenticated route lazy-loads it, redirects to sign-in, and lazy-loads that too. Vendor code is split into vendor-react, vendor-router, vendor-ui and vendor-net via manualChunks. The main chunk was 95% dependencies, so the first load is not much smaller - the dependency set is the load - but the chunk that changes on every deploy is now 50 KB (14 KB gzipped) rather than 682 KB. A returning visitor after a deploy re-downloads the app, not React. The favicon was 888 KB: PNG data under a .jpg name, 768x768, with a fully opaque alpha channel, fetched on every page load. It is a 2.6 KB 32px PNG now, with a 180px apple-touch-icon, and manifest.json points at real 192px and 512px PNGs with the correct type instead of declaring the same mislabelled file at both sizes. The service worker's notification icon pointed at a /favicon.ico that never existed. The useGameStore selector item from M26 was already done in WP-10. Addresses M26.
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel (or oxc when used in rolldown-vite) for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
Languages
TypeScript
97.7%
CSS
0.8%
JavaScript
0.7%
Shell
0.4%
Dockerfile
0.2%
Other
0.2%