HMR on Windows (#3144)

* Enable hot module reloading on Windows

* Update VSC launch.json and tasks.json

* Bind vite server to 127.0.0.1 (dae)

Our frontend connects via IP, and on Windows, this fails if the server
is bound to 'localhost' instead.
This commit is contained in:
RumovZ 2024-04-17 13:23:34 +02:00 committed by GitHub
parent 0a706c5dd9
commit ebc6c0847a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 9 deletions

View File

@ -6,9 +6,13 @@
"configurations": [ "configurations": [
{ {
"name": "Run", "name": "Run",
"type": "python", "type": "debugpy",
"request": "launch", "request": "launch",
"program": "tools/run.py", "program": "tools/run.py",
"args": [
// "-p",
// "My test profile"
],
"console": "integratedTerminal", "console": "integratedTerminal",
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"python": "${workspaceFolder}/out/pyenv/bin/python", "python": "${workspaceFolder}/out/pyenv/bin/python",
@ -20,7 +24,12 @@
"PYTHONPYCACHEPREFIX": "out/pycache", "PYTHONPYCACHEPREFIX": "out/pycache",
"ANKIDEV": "1", "ANKIDEV": "1",
"QTWEBENGINE_REMOTE_DEBUGGING": "8080", "QTWEBENGINE_REMOTE_DEBUGGING": "8080",
"QTWEBENGINE_CHROMIUM_FLAGS": "--remote-allow-origins=http://localhost:8080" "QTWEBENGINE_CHROMIUM_FLAGS": "--remote-allow-origins=http://localhost:8080",
"RUST_BACKTRACE": "1",
// "TRACESQL": "1",
// "HMR": "1",
"ANKI_API_PORT": "40000",
"ANKI_API_HOST": "127.0.0.1"
}, },
"justMyCode": true, "justMyCode": true,
"preLaunchTask": "ninja" "preLaunchTask": "ninja"

View File

@ -9,14 +9,8 @@
"qt" "qt"
], ],
"windows": { "windows": {
"command": "bash", "command": "tools/ninja.bat",
"options": {
"env": {
"PATH": "c:\\msys64\\usr\\bin;${env:Path}"
}
},
"args": [ "args": [
"ninja",
"pylib", "pylib",
"qt", "qt",
"extract:win_amd64_audio" "extract:win_amd64_audio"

View File

@ -6,6 +6,8 @@ set PYTHONPYCACHEPREFIX=out\pycache
set ANKIDEV=1 set ANKIDEV=1
set QTWEBENGINE_REMOTE_DEBUGGING=8080 set QTWEBENGINE_REMOTE_DEBUGGING=8080
set QTWEBENGINE_CHROMIUM_FLAGS=--remote-allow-origins=http://localhost:8080 set QTWEBENGINE_CHROMIUM_FLAGS=--remote-allow-origins=http://localhost:8080
set ANKI_API_PORT=40000
set ANKI_API_HOST=127.0.0.1
call tools\ninja pylib qt extract:win_amd64_audio || exit /b 1 call tools\ninja pylib qt extract:win_amd64_audio || exit /b 1
.\out\pyenv\scripts\python tools\run.py %* || exit /b 1 .\out\pyenv\scripts\python tools\run.py %* || exit /b 1

View File

@ -29,6 +29,7 @@ export default defineConfig({
reportCompressedSize: false, reportCompressedSize: false,
}, },
server: { server: {
host: "127.0.0.1",
fs: { fs: {
// Allow serving files project root and out dir // Allow serving files project root and out dir
allow: [ allow: [