Skip to content

Commit 11424f0

Browse files
committed
refactor(web): upgrade cloudflare build config
1 parent 424a441 commit 11424f0

File tree

29 files changed

+2746
-813
lines changed

29 files changed

+2746
-813
lines changed

apps/mobile/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"readable-stream": "4.5.2",
147147
"redux-persist": "6.0.0",
148148
"uuid": "10.0.0",
149-
"zod": "3.24.1"
149+
"zod": "3.24.2"
150150
},
151151
"devDependencies": {
152152
"@babel/core": "7.24.6",
@@ -162,7 +162,7 @@
162162
"@types/jest": "29.5.12",
163163
"@types/lodash.groupby": "4.6.9",
164164
"@types/lodash.merge": "4.6.9",
165-
"@types/node": "22.13.5",
165+
"@types/node": "22.13.13",
166166
"@types/react": "18.2.79",
167167
"@types/react-dom": "18.2.25",
168168
"babel-jest": "29.7.0",

apps/web/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
/node_modules/
3+
*.tsbuildinfo
34

45
# React Router
56
/.react-router/

apps/web/app/routes/earn.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ export function meta({}: Route.MetaArgs) {
1818
}
1919

2020
export default function HomeRoute() {
21-
return <Earn content={''} />;
21+
return <Earn />;
2222
}

apps/web/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"start": "react-router-serve ./build/server/index.js",
1111
"test:coverage": "vitest run --coverage",
1212
"test:unit": "vitest run",
13-
"typecheck": "react-router typegen && tsc"
13+
"typecheck": "wrangler types && react-router typegen && tsc -b"
1414
},
1515
"dependencies": {
1616
"@leather.io/models": "workspace:*",
@@ -36,25 +36,26 @@
3636
"react-hook-form": "7.53.2",
3737
"react-router": "7.4.0",
3838
"safe-buffer": "5.2.1",
39-
"zod": "3.24.1"
39+
"zod": "3.24.2"
4040
},
4141
"devDependencies": {
42+
"@cloudflare/vite-plugin": "0.1.15",
4243
"@cloudflare/workers-types": "4.20250303.0",
4344
"@originjs/vite-plugin-commonjs": "1.0.3",
4445
"@pandacss/dev": "0.53.1",
4546
"@playwright/test": "1.51.0",
4647
"@react-router/cloudflare": "7.4.0",
4748
"@react-router/dev": "7.4.0",
48-
"@types/node": "22.13.5",
49+
"@types/node": "22.13.13",
4950
"@types/nprogress": "0.2.3",
50-
"@types/react": "19.0.10",
51+
"@types/react": "19.0.12",
5152
"@types/react-dom": "19.0.4",
5253
"react-router-devtools": "1.1.6",
5354
"typescript": "5.7.3",
54-
"vite": "6.2.0",
55+
"vite": "6.2.3",
5556
"vite-plugin-svgr": "4.3.0",
5657
"vite-tsconfig-paths": "5.1.4",
5758
"vitest": "2.1.9",
58-
"wrangler": "3.114.0"
59+
"wrangler": "3.114.1"
5960
}
6061
}

apps/web/public/favicon.ico

-10.5 KB
Binary file not shown.

apps/web/react-router.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ export default {
44
// Config options...
55
// Server-side render by default, to enable SPA mode set this to `false`
66
ssr: true,
7+
future: {
8+
unstable_viteEnvironmentApi: true,
9+
},
710
} satisfies Config;

apps/web/tsconfig.cloudflare.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"app/**/.server/**/*",
77
"app/**/.client/**/*",
88
"workers/**/*",
9-
"worker-configuration.d.ts",
10-
"./leather-styles/**/*"
9+
"worker-configuration.d.ts"
1110
],
1211
"compilerOptions": {
1312
"composite": true,
@@ -22,7 +21,8 @@
2221
"rootDirs": [".", "./.react-router/types"],
2322
"paths": {
2423
"~/*": ["./app/*"],
25-
"react": ["./node_modules/@types/react"]
24+
"react": ["./node_modules/@types/react"],
25+
"leather-styles/*": ["./leather-styles/*"]
2626
},
2727
"esModuleInterop": true,
2828
"resolveJsonModule": true

apps/web/vite.config.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1+
import { cloudflare } from '@cloudflare/vite-plugin';
12
import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
23
import pandacss from '@pandacss/dev/postcss';
34
import { reactRouter } from '@react-router/dev/vite';
4-
import { cloudflareDevProxy } from '@react-router/dev/vite/cloudflare';
55
import path from 'node:path';
66
import { defineConfig } from 'vite';
77
import svgr from 'vite-plugin-svgr';
88
import tsconfigPaths from 'vite-tsconfig-paths';
99

10-
export default defineConfig(({ isSsrBuild }) => ({
11-
build: {
12-
rollupOptions: {
13-
...(isSsrBuild
14-
? {
15-
input: './workers/app.ts',
16-
}
17-
: undefined),
18-
},
19-
},
10+
export default defineConfig({
2011
css: {
2112
postcss: {
2213
// Type error with Panda plugin
@@ -29,14 +20,10 @@ export default defineConfig(({ isSsrBuild }) => ({
2920
},
3021
},
3122
plugins: [
23+
cloudflare({ viteEnvironment: { name: 'ssr' } }),
3224
svgr({ include: '**/*.svg' }),
33-
cloudflareDevProxy({
34-
getLoadContext({ context }) {
35-
return { cloudflare: context.cloudflare };
36-
},
37-
}),
3825
viteCommonjs(),
3926
reactRouter(),
4027
tsconfigPaths(),
4128
],
42-
}));
29+
});

apps/web/workers/app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ declare module 'react-router' {
1414
}
1515

1616
const requestHandler = createRequestHandler(
17-
// @ts-expect-error - virtual module provided by React Router at build time
1817
() => import('virtual:react-router/server-build'),
1918
import.meta.env.MODE
2019
);

apps/web/wrangler.jsonc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "node_modules/wrangler/config-schema.json",
3+
"name": "leather-web",
4+
"compatibility_date": "2025-02-24",
5+
"main": "./workers/app.ts",
6+
"workers_dev": true,
7+
"assets": {},
8+
"send_metrics": false,
9+
"observability": {
10+
"enabled": false
11+
},
12+
"vars": {
13+
"VALUE_FROM_CLOUDFLARE": "Hello from Cloudflare"
14+
}
15+
}

0 commit comments

Comments
 (0)