Skip to content

DOCXKIT_PLUGIN_NOT_REGISTERED: 插件未注册 ​

plugin 节点引用了未注册的运行时名称,PDK 断言也会用此码报告无效插件实例。

修复步骤 ​

  1. 导出前调用插件工厂,将返回的实例传给 .use()。
  2. 节点名必须匹配 plugin.name,第三方工厂名称不一定遵循内置命名方式。
  3. JSON DSL 同样需要注册插件。

问题示例 ​

ts
import { createDocx } from 'docx-kit'

await createDocx()
  .plugin('qrcode', { text: 'https://example.com' })
  .toBlob()

修复示例 ​

ts
import { createDocx, qrcodePlugin } from 'docx-kit'

const doc = createDocx()
  .use(qrcodePlugin())
  .plugin('qrcode', { text: 'https://example.com' })
const blob = await doc.toBlob()

常见原因 ​

  • 遗漏 .use()、未调用工厂,或运行时名称不一致。

诊断字段 ​

消息示例 ​

text
Plugin not registered: qrcode

源码与相关指南 ​

Released under the MIT License.