Fix the issue of slow startup when using wails3 dev
This commit is contained in:
@@ -5,19 +5,19 @@ version: '3'
|
||||
|
||||
# This information is used to generate the build assets.
|
||||
info:
|
||||
companyName: "My Company" # The name of the company
|
||||
productName: "My Product" # The name of the application
|
||||
productIdentifier: "com.mycompany.myproduct" # The unique product identifier
|
||||
description: "A program that does X" # The application description
|
||||
copyright: "(c) 2025, My Company" # Copyright text
|
||||
comments: "Some Product Comments" # Comments
|
||||
companyName: "Twitter Account" # The name of the company
|
||||
productName: "Twitter Account Manager" # The name of the application
|
||||
productIdentifier: "com.twitteraccount.app" # The unique product identifier
|
||||
description: "Twitter account management application" # The application description
|
||||
copyright: "(c) 2025, Twitter Account" # Copyright text
|
||||
comments: "Twitter Account Manager" # Comments
|
||||
version: "0.0.1" # The application version
|
||||
|
||||
# Dev mode configuration
|
||||
dev_mode:
|
||||
root_path: .
|
||||
log_level: warn
|
||||
debounce: 1000
|
||||
debounce: 300
|
||||
ignore:
|
||||
dir:
|
||||
- .git
|
||||
@@ -32,12 +32,10 @@ dev_mode:
|
||||
- "*.go"
|
||||
git_ignore: true
|
||||
executes:
|
||||
- cmd: wails3 task common:install:frontend:deps
|
||||
type: once
|
||||
- cmd: wails3 task common:dev:frontend
|
||||
type: background
|
||||
- cmd: go mod tidy
|
||||
type: blocking
|
||||
type: background # 改回 background,让它持续运行
|
||||
- cmd: powershell.exe -ExecutionPolicy Bypass -File build/wait.ps1 -Seconds 15
|
||||
type: blocking # 等待 15 秒让前端完全启动
|
||||
- cmd: wails3 task build
|
||||
type: blocking
|
||||
- cmd: wails3 task run
|
||||
|
||||
28
build/wait.ps1
Normal file
28
build/wait.ps1
Normal file
@@ -0,0 +1,28 @@
|
||||
# Wait for a specified number of seconds and check the frontend server
|
||||
param(
|
||||
[int]$Seconds = 5,
|
||||
[string]$Url = "http://localhost:9245"
|
||||
)
|
||||
|
||||
Write-Host "Waiting for frontend to start..." -ForegroundColor Yellow
|
||||
|
||||
$elapsed = 0
|
||||
$interval = 1
|
||||
|
||||
while ($elapsed -lt $Seconds) {
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri $Url -Method Head -TimeoutSec 1 -ErrorAction SilentlyContinue
|
||||
if ($response.StatusCode -eq 200) {
|
||||
Write-Host "✓ Frontend server is ready ($elapsed seconds)" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
} catch {
|
||||
# Continue waiting
|
||||
}
|
||||
|
||||
Start-Sleep -Seconds $interval
|
||||
$elapsed += $interval
|
||||
Write-Host " Waiting... ($elapsed/$Seconds seconds)" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
Write-Host "✓ Waiting finished (up to $Seconds seconds)" -ForegroundColor Green
|
||||
Reference in New Issue
Block a user