Skip to content

插件市场装的插件在 v2.0.0 中无法加载:loader 从 app.asar.unpacked 解析,插件在 profile 的 node_modules #73

Description

@fkysly

你们在我们的友情链接里,所以这个我直接来说一声——在 dsh-desktop v2.0.0 里,通过插件市场装的插件装完用不了,我们收到的报告是 dsh-market#129,用户最后只能改用网页端。

现象

市场把插件装进 profile 的 node_modules,装完显示「已进入 bundle 层但未热挂载,重启后生效」,重启后仍然加载不到。用户日志里的关键一行:

hot-mount: @liustack/modlens: fell back to restart —
  Cannot find package '@liustack/modlens' imported from
  D:\Harness_exe\DSH Desktop\resources\app.asar.unpacked\node_modules\@deepseek-ai\cordis-plugin-loader\lib\index.js

加载器是从 应用自己的 app.asar.unpacked/node_modules 去解析这个包的,而插件在 profile 的 node_modules 里。两边对不上,所以热挂载和重启后的 bundle 层加载都失败。

为什么会这样

我们理解 Electron 打包后模块解析锚定在应用目录是常见结果。问题是插件必须装在 profile 里(那是 dsh 的 profile 模型决定的),于是 loader 找不到它们。

普通 dsh web 下同一批插件是正常的——同一个用户切到网页端就好了,这也是我们判断问题在集成层而不在插件或市场的依据。

两条可能的方向

供参考,具体怎么做你们最清楚:

  1. 让 loader 的解析路径包含当前 profile 的 node_modules(多数情况下这一条就够)
  2. 实现宿主侧的包操作契约,让市场把安装委托给应用自己的运行时。anywhere-labs 的 Desktop 定义过一版公开契约,我们已经适配:plugin-services.md —— 提供 desktopProfilesdesktopPnpm 两个服务即可,市场检测到就会自动改走那条路径,不需要你们改市场的代码。

我们这边不会为任何单一 Desktop 做绑定性改动(市场是独立插件,得对所有宿主一视同仁),但只要是公开契约,我们乐意适配。

需要什么配合尽管说

如果你们想验证修复效果,我们的插件市场从 npm 装就行(dsh plugin --profile web add dshmarket),装完在设置里能看到。有需要我们也可以帮忙复测。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions