Open Sun-ZhenXing opened 2 weeks ago
I found a workaround:
{
devServer: {
host: isMobile ? '0.0.0.0' : undefined,
},
hooks: {
'vite:extend': function ({ config }) {
if (config.server && config.server.hmr && config.server.hmr !== true) {
config.server.hmr.protocol = 'ws'
config.server.hmr.host = '192.168.XXX.XXX'
config.server.hmr.port = 3000
}
},
},
vite: {
clearScreen: false,
envPrefix: ['VITE_', 'TAURI_'],
server: {
strictPort: true,
watch: {
ignored: ['**/src-tauri/**'],
},
},
},
}
But I think undefined
appearing in URLs is a bug.
Describe the bug
The methods described in this document does not mark HMR work on mobile devices.
Because Nuxt does not use vite's HMR config. Nuxt rewrite vite config, and uses
ws://$host:$port/_nuxt/
to provide HMR:It tries to connect to
localhost:undefined
andtauri.localhost
, but this is incorrect.All endpoints have been tried and there is no WebSocket support. This may require a direct connection to the host.
Reproduction
From official document: https://v2.tauri.app/start/frontend/nuxt/
If this is not detailed enough, please call me for reproduction.
Expected behavior
No error.
Full
tauri info
outputStack trace
Additional context
No response