Skip to content

Commit

Permalink
Update vite.config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric authored Nov 21, 2024
1 parent 9bfb943 commit 5773c83
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions MyApp.Client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,30 @@ if (!certificateName) {
const certFilePath = path.join(baseFolder, `${certificateName}.pem`);
const keyFilePath = path.join(baseFolder, `${certificateName}.key`);

console.log(`Certificate path: ${certFilePath}`);

if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {
if (0 !== child_process.spawnSync('dotnet', [
'dev-certs',
'https',
'--export-path',
certFilePath,
'--format',
'Pem',
'--no-password',
], { stdio: 'inherit', }).status) {

// 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

0 comments on commit 5773c83

Please sign in to comment.