[Bug] Node 24.0–24.11.1 下 dsh web 0.1.2 alpha.1 启动失败,前端报 "HTML did not preload @deepseek-ai/dsh-client-modules/client.js" #4959
Closed
good770326
started this conversation in
General
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
原因是有代码简单按 Node 主版本判断区分接口,但有些接口在同个 Node 主版本内有变。
使用者升级 Node 到 v24.12.0 及以上(如最新 LTS v24.20.0)可规避。
具体如下(AI分析):
环境
pnpm dsh web复现步骤
pnpm dsh web实际行为
页面加载后显示:
服务端返回的 HTML 中
window.__DSH_BOOT__为空:{"rev":"240c4d8dcf0d","entries":[],"batches":[]}期望行为
__DSH_BOOT__正常填充所有dsh.client客户端模块,前端插件正常加载。根因分析
vendor/loader/src/internal.ts的ModuleLoader.fromInternal()对所有 Node>= 24都标记为 v2 接口:但 v2 接口(
resolveSync(parentURL, request)+getOrCreateModuleJob)实际是在Node 24.12.0 才引入的。Node 24.0–24.11.1 仍然是 v1 接口
(
resolveSync(specifier, parentURL, attributes)+getModuleJobForImport)。在 Node v24.11.1 上实测:
getOrInitializeCascadedLoader()返回的对象包含resolve、getModuleJobForImport,但没有
getOrCreateModuleJob。resolveSync(specifier, parentURL, {})正常返回。resolveSync(parentURL, { specifier, attributes })抛ERR_INVALID_ARG_TYPE。于是
packages/client/modules/src/index.ts的locatePkgJson走 v2 分支、参数错位,异常被
try/catch吞掉后返回undefined,所有dsh.client包被跳过,__DSH_BOOT__为空。vendor/hmr/src/index.ts的_resolve同样依赖internal.version分支,同样受影响。影响范围
Node
>=24.0.0 <24.12.0(在engines声明的范围内),仅影响 web 界面。Node 22/23 与 Node
>=24.12.0不受影响。建议修复方向
fromInternal()改为按实际接口方法检测,而非按 major 版本:All reactions