From 9e0f421c14f74b4d32044acf3d3acfb5cd0114df Mon Sep 17 00:00:00 2001 From: iven Date: Wed, 13 May 2026 23:56:54 +0800 Subject: [PATCH] =?UTF-8?q?chore(mp):=20=E6=B7=BB=E5=8A=A0=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E5=90=AF=E5=8A=A8=E8=84=9A=E6=9C=AC=EF=BC=88=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=B8=85=E7=90=86+=E7=BC=96=E8=AF=91=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/miniprogram/dev.ps1 | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 apps/miniprogram/dev.ps1 diff --git a/apps/miniprogram/dev.ps1 b/apps/miniprogram/dev.ps1 new file mode 100644 index 0000000..f3d5f49 --- /dev/null +++ b/apps/miniprogram/dev.ps1 @@ -0,0 +1,36 @@ +# HMS 小程序开发启动脚本 +# 用法:右键 → 使用 PowerShell 运行,或在终端中 ./dev.ps1 + +Write-Host "=== HMS 小程序开发环境 ===" -ForegroundColor Cyan + +# 1. 提升文件描述符限制 +Write-Host "[1/3] 设置文件描述符限制..." -ForegroundColor Yellow +try { + $current = (Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems" -Name "Windows" -ErrorAction Stop).Windows + Write-Host " 系统文件描述符配置已读取" -ForegroundColor Green +} catch { + Write-Host " 无法读取系统配置(需要管理员权限)" -ForegroundColor Red +} + +# 2. 清理缓存 +Write-Host "[2/3] 清理构建缓存..." -ForegroundColor Yellow +if (Test-Path "dist") { + Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue + Write-Host " dist 已清理" -ForegroundColor Green +} +if (Test-Path "node_modules\.cache") { + Remove-Item -Recurse -Force node_modules\.cache -ErrorAction SilentlyContinue + Write-Host " webpack cache 已清理" -ForegroundColor Green +} + +# 3. 启动开发编译 +Write-Host "[3/3] 启动 Taro 开发编译..." -ForegroundColor Yellow +Write-Host "" +$env:NODE_ENV = "development" +npx taro build --type weapp --watch + +Write-Host "" +Write-Host "提示:" -ForegroundColor Cyan +Write-Host " - 编译完成后在微信开发者工具中导入 dist 目录" +Write-Host " - 如遇到 EMFILE 错误,请重启此脚本" +Write-Host " - 建议每 2 小时重启微信开发者工具防止内存泄漏"