Skip to content

Commit 0325172

Browse files
committed
updates
1 parent 843c0ff commit 0325172

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

MyApp.Client/vite.config.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ const isProd = process.env.NODE_ENV === 'production'
1010
const buildLocal = process.env.MODE === 'local'
1111

1212
// Define DEPLOY_API first
13-
const DEPLOY_API = process.env.KAMAL_DEPLOY_HOST
14-
? `https://${process.env.KAMAL_DEPLOY_HOST}`
13+
const DEPLOY_API = process.env.KAMAL_DEPLOY_HOST
14+
? `https://${process.env.KAMAL_DEPLOY_HOST}`
1515
: target
1616

1717
// Now use it for API_URL
1818
const API_URL = isProd ? DEPLOY_API : (buildLocal ? '' : target)
1919

2020
// Only required if accessing vite directly, e.g. http://localhost:5173
2121
const proxy = {
22-
'^/api': {
23-
target,
24-
secure: false
25-
}
22+
'^/api': {
23+
target,
24+
secure: false
2625
}
26+
}
2727

2828
export default defineConfig({
2929
define: { apiBaseUrl: `"${API_URL}"` },
@@ -41,6 +41,6 @@ export default defineConfig({
4141
},
4242
server: {
4343
host: true, // Listen on all interfaces (both IPv4 and IPv6)
44-
proxy,
45-
}
44+
proxy,
45+
}
4646
})

MyApp/Program.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
services.AddServiceStack(typeof(MyServices).Assembly);
3939

4040
var app = builder.Build();
41-
var nodeProxy = new NodeProxy("http://localhost:5173") {
41+
var nodeProxy = new NodeProxy("http://127.0.0.1:5173") {
4242
Log = app.Logger
4343
};
4444

@@ -72,14 +72,13 @@
7272
// Proxy development HMR WebSocket and fallback routes to the Node server
7373
if (app.Environment.IsDevelopment())
7474
{
75-
app.UseWebSockets();
76-
app.MapViteHmr(nodeProxy);
77-
7875
// Start the Vite dev server if the lockfile does not exist
7976
app.RunNodeProcess(nodeProxy,
8077
lockFile: "../MyApp.Client/dist/lock",
8178
workingDirectory: "../MyApp.Client");
8279

80+
app.UseWebSockets();
81+
app.MapViteHmr(nodeProxy);
8382
app.MapFallbackToNode(nodeProxy);
8483
}
8584
else

MyApp/Properties/launchSettings.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"commandName": "Project",
2323
"dotnetRunMessages": true,
2424
"launchBrowser": true,
25+
"launchUrl": "",
2526
"applicationUrl": "https://localhost:5001;http://localhost:5000",
2627
"environmentVariables": {
2728
"ASPNETCORE_ENVIRONMENT": "Development"
@@ -30,11 +31,9 @@
3031
"IIS Express": {
3132
"commandName": "IISExpress",
3233
"launchBrowser": true,
33-
"launchUrl": "metadata",
3434
"environmentVariables": {
3535
"ASPNETCORE_ENVIRONMENT": "Development"
3636
}
3737
}
3838
}
39-
}
40-
39+
}

0 commit comments

Comments
 (0)