Skip to content

Commit 5773c83

Browse files
authored
Update vite.config.ts
1 parent 9bfb943 commit 5773c83

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

MyApp.Client/vite.config.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,30 @@ if (!certificateName) {
3535
const certFilePath = path.join(baseFolder, `${certificateName}.pem`);
3636
const keyFilePath = path.join(baseFolder, `${certificateName}.key`);
3737

38+
console.log(`Certificate path: ${certFilePath}`);
39+
3840
if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {
39-
if (0 !== child_process.spawnSync('dotnet', [
40-
'dev-certs',
41-
'https',
42-
'--export-path',
43-
certFilePath,
44-
'--format',
45-
'Pem',
46-
'--no-password',
47-
], { stdio: 'inherit', }).status) {
41+
42+
// mkdir to fix dotnet dev-certs error 3 https://github.com/dotnet/aspnetcore/issues/58330
43+
if (!fs.existsSync(baseFolder)) {
44+
fs.mkdirSync(baseFolder, { recursive: true });
45+
}
46+
if (
47+
0 !==
48+
child_process.spawnSync(
49+
"dotnet",
50+
[
51+
"dev-certs",
52+
"https",
53+
"--export-path",
54+
certFilePath,
55+
"--format",
56+
"Pem",
57+
"--no-password",
58+
],
59+
{ stdio: "inherit" }
60+
).status
61+
) {
4862
throw new Error("Could not create certificate.");
4963
}
5064
}

0 commit comments

Comments
 (0)