Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions MyApp.Client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"classnames": "^2.5.1",
"clsx": "^2.1.1",
"gray-matter": "^4.0.3",
"lucide-react": "^0.510.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router": "^7.6.0",
Expand All @@ -37,18 +36,19 @@
"@tailwindcss/typography": "^0.5.16",
"@tailwindcss/vite": "^4.1.6",
"@types/mdx": "^2.0.13",
"@types/node": "^22.15.17",
"@types/node": "^24.10.0",
"@types/react": "^19.1.4",
"@types/react-dom": "^19.1.5",
"@types/react-helmet": "^6.1.11",
"@types/remark-prism": "^1.3.7",
"@typescript-eslint/eslint-plugin": "^8.32.1",
"@typescript-eslint/parser": "^8.32.1",
"@vitejs/plugin-react": "^4.4.1",
"@vitejs/plugin-react": "^5.1.0",
"autoprefixer": "^10.4.21",
"eslint": "^9.26.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.20",
"lucide-react": "^0.552.0",
"postcss": "^8.5.3",
"rehype-raw": "^7.0.0",
"rehype-stringify": "^10.0.1",
Expand All @@ -59,7 +59,7 @@
"remark-prism": "^1.3.6",
"tailwindcss": "^4.1.6",
"typescript": "^5.8.3",
"vite": "^6.3.5",
"vite": "^7.2.1",
"vite-plugin-pages": "^0.33.0",
"vite-plugin-press": "^1.0.10",
"vite-plugin-svgr": "^4.3.0"
Expand Down
66 changes: 38 additions & 28 deletions MyApp.Client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,36 @@ if (!certificateName) {
const certFilePath = path.join(baseFolder, `${certificateName}.pem`);
const keyFilePath = path.join(baseFolder, `${certificateName}.key`);

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

if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {
if (isDevServer) {
console.log(`Certificate path: ${certFilePath}`);

// mkdir to fix dotnet dev-certs error 3 https://github.com/dotnet/aspnetcore/issues/58330
if (!fs.existsSync(baseFolder)) {
fs.mkdirSync(baseFolder, { recursive: true });
}
if (
0 !==
child_process.spawnSync(
"dotnet",
[
"dev-certs",
"https",
"--export-path",
certFilePath,
"--format",
"Pem",
"--no-password",
],
{ stdio: "inherit" }
).status
) {
throw new Error("Could not create certificate.");
if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {

// mkdir to fix dotnet dev-certs error 3 https://github.com/dotnet/aspnetcore/issues/58330
if (!fs.existsSync(baseFolder)) {
fs.mkdirSync(baseFolder, { recursive: true });
}
if (
0 !==
child_process.spawnSync(
"dotnet",
[
"dev-certs",
"https",
"--export-path",
certFilePath,
"--format",
"Pem",
"--no-password",
],
{ stdio: "inherit" }
).status
) {
throw new Error("Could not create certificate.");
}
}
}

Expand Down Expand Up @@ -100,7 +105,7 @@ export default defineConfig(async () => {
tailwindcss(),
Press({
baseUrl,
//Uncomment to generate metadata *.json
//Uncomment to generate metadata *.json
//metadataPath: './public/api',
}),
],
Expand All @@ -109,6 +114,9 @@ export default defineConfig(async () => {
'@': fileURLToPath(new URL('./src', import.meta.url)),
}
},
build: {
target: 'baseline-widely-available',
},
server: {
proxy: {
'^/api': {
Expand All @@ -117,10 +125,12 @@ export default defineConfig(async () => {
}
},
port: 5173,
https: {
key: fs.readFileSync(keyFilePath),
cert: fs.readFileSync(certFilePath),
}
...(fs.existsSync(keyFilePath) && fs.existsSync(certFilePath) ? {
https: {
key: fs.readFileSync(keyFilePath),
cert: fs.readFileSync(certFilePath),
}
} : {})
}
}
})
Loading