@nativescript/vite 0.0.1-alpha.5 → 0.0.1-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -267,7 +267,7 @@ export const baseConfig = ({ mode }) => {
|
|
|
267
267
|
? {
|
|
268
268
|
// Expose dev server to local network so simulator or device can connect
|
|
269
269
|
host: process.env.NS_HMR_HOST ||
|
|
270
|
-
(platform === "android" ? "
|
|
270
|
+
(platform === "android" ? "0.0.0.0" : "localhost"),
|
|
271
271
|
// Use a stable port so the device URL remains correct
|
|
272
272
|
port: 5173,
|
|
273
273
|
strictPort: true,
|
package/dist/hmr/client-vue.js
CHANGED
|
@@ -15,12 +15,12 @@ const recentHmr = new Map();
|
|
|
15
15
|
let httpOriginForVite;
|
|
16
16
|
function deriveHttpOrigin(wsUrl) {
|
|
17
17
|
try {
|
|
18
|
-
const url = new URL(wsUrl || "ws://
|
|
18
|
+
const url = new URL(wsUrl || "ws://10.0.2.2:5173/ns-hmr");
|
|
19
19
|
const http = url.protocol === "wss:" ? "https:" : "http:";
|
|
20
20
|
return `${http}//${url.host}`;
|
|
21
21
|
}
|
|
22
22
|
catch {
|
|
23
|
-
return "http://
|
|
23
|
+
return "http://10.0.2.2:5173";
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function connectHmr() {
|
|
@@ -32,7 +32,7 @@ function connectHmr() {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
try {
|
|
35
|
-
const wsUrl = hmrWsUrl || "ws://
|
|
35
|
+
const wsUrl = hmrWsUrl || "ws://10.0.2.2:5173/ns-hmr";
|
|
36
36
|
if (VERBOSE)
|
|
37
37
|
console.log("[hmr-client-vue] Connecting to HMR WebSocket:", wsUrl);
|
|
38
38
|
hmrSocket = new WebSocket(wsUrl);
|
|
@@ -20,9 +20,14 @@ export function hmrPluginVue(platform, verboseLogs = false) {
|
|
|
20
20
|
return null;
|
|
21
21
|
const clientPath = require.resolve("@nativescript/vite/dist/hmr/client-vue.js");
|
|
22
22
|
// Build ws url from Vite server info
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
let host = process.env.NS_HMR_HOST || config?.server?.host;
|
|
24
|
+
// Fix for Android: if host is 0.0.0.0 (which is used to expose server), use 10.0.2.2 for client connection
|
|
25
|
+
if (platform === 'android' && (host === '0.0.0.0' || !host)) {
|
|
26
|
+
host = "10.0.2.2";
|
|
27
|
+
}
|
|
28
|
+
else if (!host) {
|
|
29
|
+
host = "localhost";
|
|
30
|
+
}
|
|
26
31
|
const port = Number(config?.server?.port || 5173);
|
|
27
32
|
const secure = !!config?.server?.https;
|
|
28
33
|
const protocol = secure ? "wss" : "ws";
|