Skip to content

Commit e3735ef

Browse files
committed
feat(netlify): use new @netlify/vite-plugin-react-router
See https://github.com/netlify/remix-compute/tree/main/packages/vite-plugin-react-router
1 parent a7fc410 commit e3735ef

File tree

7 files changed

+72
-147
lines changed

7 files changed

+72
-147
lines changed

netlify/dev-server.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

netlify/netlify.toml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
[build]
2-
command = "npm run build"
2+
command = "react-router build"
33
publish = "build/client"
44

55
[dev]
6-
command = "npm run dev"
7-
framework = "vite"
8-
9-
# Set immutable caching for static files, because they have fingerprinted filenames
10-
11-
[[headers]]
12-
for = "/assets/*"
13-
[headers.values]
14-
"Cache-Control" = "public, max-age=31560000, immutable"
6+
command = "react-router dev"

netlify/netlify/prepare.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

netlify/package.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,22 @@
22
"private": true,
33
"type": "module",
44
"scripts": {
5-
"build": "react-router build && node netlify/prepare.js",
6-
"dev": "cross-env NODE_ENV=development node ./dev-server.js",
5+
"build": "react-router build",
6+
"dev": "react-router dev",
77
"start": "netlify serve",
88
"typecheck": "react-router typegen && tsc"
99
},
1010
"dependencies": {
11-
"@netlify/functions": "2.8.2",
12-
"@react-router/node": "*",
13-
"isbot": "^5.1.17",
1411
"react": "^19.0.0",
1512
"react-dom": "^19.0.0",
1613
"react-router": "*"
1714
},
1815
"devDependencies": {
19-
"@mjackson/node-fetch-server": "0.3.0",
16+
"@netlify/vite-plugin-react-router": "^1.0.0",
2017
"@react-router/dev": "*",
21-
"@types/express": "^5.0.0",
2218
"@types/react": "^19.0.1",
2319
"@types/react-dom": "^19.0.1",
2420
"autoprefixer": "^10.4.20",
25-
"cross-env": "^7.0.3",
26-
"express": "^4.21.1",
2721
"netlify-cli": "^17.38.0",
2822
"postcss": "^8.4.49",
2923
"tailwindcss": "^3.4.16",

netlify/server/app.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

netlify/vite.config.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ import autoprefixer from "autoprefixer";
33
import tailwindcss from "tailwindcss";
44
import { defineConfig } from "vite";
55
import tsconfigPaths from "vite-tsconfig-paths";
6+
import netlifyPlugin from "@netlify/vite-plugin-react-router";
67

7-
export default defineConfig(({ isSsrBuild }) => ({
8-
build: {
9-
rollupOptions: isSsrBuild
10-
? {
11-
input: "./server/app.ts",
12-
}
13-
: undefined,
14-
},
8+
export default defineConfig({
159
css: {
1610
postcss: {
1711
plugins: [tailwindcss, autoprefixer],
1812
},
1913
},
20-
plugins: [reactRouter(), tsconfigPaths()],
21-
}));
14+
plugins: [reactRouter(), tsconfigPaths(), netlifyPlugin()],
15+
});

pnpm-lock.yaml

Lines changed: 63 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)