Skip to content

Commit 3814e1f

Browse files
authored
Merge pull request #6 from NetCoreTemplates/claude/upgrade-vite-react-template-011CUrph1htfTzMWg6HL4dzC
Upgrade Vite React template dependencies
2 parents d2993a2 + 6736c16 commit 3814e1f

File tree

2 files changed

+43
-33
lines changed

2 files changed

+43
-33
lines changed

MyApp.Client/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"classnames": "^2.5.1",
2121
"clsx": "^2.1.1",
2222
"gray-matter": "^4.0.3",
23-
"lucide-react": "^0.510.0",
2423
"react": "^19.1.0",
2524
"react-dom": "^19.1.0",
2625
"react-router": "^7.6.0",
@@ -37,18 +36,19 @@
3736
"@tailwindcss/typography": "^0.5.16",
3837
"@tailwindcss/vite": "^4.1.6",
3938
"@types/mdx": "^2.0.13",
40-
"@types/node": "^22.15.17",
39+
"@types/node": "^24.10.0",
4140
"@types/react": "^19.1.4",
4241
"@types/react-dom": "^19.1.5",
4342
"@types/react-helmet": "^6.1.11",
4443
"@types/remark-prism": "^1.3.7",
4544
"@typescript-eslint/eslint-plugin": "^8.32.1",
4645
"@typescript-eslint/parser": "^8.32.1",
47-
"@vitejs/plugin-react": "^4.4.1",
46+
"@vitejs/plugin-react": "^5.1.0",
4847
"autoprefixer": "^10.4.21",
4948
"eslint": "^9.26.0",
50-
"eslint-plugin-react-hooks": "^5.2.0",
49+
"eslint-plugin-react-hooks": "^7.0.1",
5150
"eslint-plugin-react-refresh": "^0.4.20",
51+
"lucide-react": "^0.552.0",
5252
"postcss": "^8.5.3",
5353
"rehype-raw": "^7.0.0",
5454
"rehype-stringify": "^10.0.1",
@@ -59,7 +59,7 @@
5959
"remark-prism": "^1.3.6",
6060
"tailwindcss": "^4.1.6",
6161
"typescript": "^5.8.3",
62-
"vite": "^6.3.5",
62+
"vite": "^7.2.1",
6363
"vite-plugin-pages": "^0.33.0",
6464
"vite-plugin-press": "^1.0.10",
6565
"vite-plugin-svgr": "^4.3.0"

MyApp.Client/vite.config.ts

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,36 @@ if (!certificateName) {
3636
const certFilePath = path.join(baseFolder, `${certificateName}.pem`);
3737
const keyFilePath = path.join(baseFolder, `${certificateName}.key`);
3838

39-
console.log(`Certificate path: ${certFilePath}`);
39+
// Only generate certificates for dev server, not for build
40+
const isDevServer = !process.argv.includes('build');
4041

41-
if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {
42+
if (isDevServer) {
43+
console.log(`Certificate path: ${certFilePath}`);
4244

43-
// mkdir to fix dotnet dev-certs error 3 https://github.com/dotnet/aspnetcore/issues/58330
44-
if (!fs.existsSync(baseFolder)) {
45-
fs.mkdirSync(baseFolder, { recursive: true });
46-
}
47-
if (
48-
0 !==
49-
child_process.spawnSync(
50-
"dotnet",
51-
[
52-
"dev-certs",
53-
"https",
54-
"--export-path",
55-
certFilePath,
56-
"--format",
57-
"Pem",
58-
"--no-password",
59-
],
60-
{ stdio: "inherit" }
61-
).status
62-
) {
63-
throw new Error("Could not create certificate.");
45+
if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {
46+
47+
// mkdir to fix dotnet dev-certs error 3 https://github.com/dotnet/aspnetcore/issues/58330
48+
if (!fs.existsSync(baseFolder)) {
49+
fs.mkdirSync(baseFolder, { recursive: true });
50+
}
51+
if (
52+
0 !==
53+
child_process.spawnSync(
54+
"dotnet",
55+
[
56+
"dev-certs",
57+
"https",
58+
"--export-path",
59+
certFilePath,
60+
"--format",
61+
"Pem",
62+
"--no-password",
63+
],
64+
{ stdio: "inherit" }
65+
).status
66+
) {
67+
throw new Error("Could not create certificate.");
68+
}
6469
}
6570
}
6671

@@ -100,7 +105,7 @@ export default defineConfig(async () => {
100105
tailwindcss(),
101106
Press({
102107
baseUrl,
103-
//Uncomment to generate metadata *.json
108+
//Uncomment to generate metadata *.json
104109
//metadataPath: './public/api',
105110
}),
106111
],
@@ -109,6 +114,9 @@ export default defineConfig(async () => {
109114
'@': fileURLToPath(new URL('./src', import.meta.url)),
110115
}
111116
},
117+
build: {
118+
target: 'baseline-widely-available',
119+
},
112120
server: {
113121
proxy: {
114122
'^/api': {
@@ -117,10 +125,12 @@ export default defineConfig(async () => {
117125
}
118126
},
119127
port: 5173,
120-
https: {
121-
key: fs.readFileSync(keyFilePath),
122-
cert: fs.readFileSync(certFilePath),
123-
}
128+
...(fs.existsSync(keyFilePath) && fs.existsSync(certFilePath) ? {
129+
https: {
130+
key: fs.readFileSync(keyFilePath),
131+
cert: fs.readFileSync(certFilePath),
132+
}
133+
} : {})
124134
}
125135
}
126136
})

0 commit comments

Comments
 (0)