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.