建议修复:Windows 下绝对路径插件条目导入失败导致 dsh web 无法启动(ERR_UNSUPPORTED_ESM_URL_SCHEME) #2896
wweixiaofun-lang
started this conversation in
General
Replies: 0 comments
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.
问题描述
Windows 上执行
pnpm dsh web启动失败,报错:根因
问题出在两处直接把绝对路径传给动态
import():vendor/loader/src/config/tree.ts的EntryTree.import(),直接使用插件条目的name;vendor/include/src/index.ts解析 JS/TS 配置文件时,直接使用this.filename。当配置中用 Windows 绝对路径(如
C:/Users/xxx/...)引用插件时,Node 的 ESM loader 会把C:当成 URL scheme 而拒绝加载。Linux/macOS 下/xxx/...本身就是合法的 ESM 路径,因此该问题只在 Windows 上暴露。修复
两处均在导入前用
pathToFileURL把绝对路径转换成file://URL,与packages/boot/app-boot中已有的处理方式保持一致:分支与补丁
修复已提交到我的 fork:
All reactions