Skip to content

DOCXKIT_MANIFEST_INVALID: 外掛資訊清單無效 ​

資訊清單欄位、版本範圍或進入點路徑無效。

修復步驟 ​

  1. 修正訊息指出的欄位。
  2. 使用非空字串、有效 semver,以及以 ./ 開頭的安全相對路徑。
  3. 確保進入點位於外掛套件內。

問題範例 ​

ts
import { validateManifest } from 'docx-kit'

const manifest = {
  name: 'example-plugin', version: '1.0.0', docxKit: '^0.7.0',
  main: './dist/index.js', plugin: { name: 'example' },
}

validateManifest({ ...manifest, main: '../outside.js' })

修復範例 ​

ts
import { validateManifest } from 'docx-kit'

const manifest = {
  name: 'example-plugin', version: '1.0.0', docxKit: '^0.7.0',
  main: './dist/index.js', plugin: { name: 'example' },
}

validateManifest(manifest)

常見原因 ​

  • 必填欄位缺失、版本範圍格式不正確,或路徑越過套件邊界。

診斷欄位 ​

訊息範例 ​

text
Plugin manifest field "main" must be a safe relative path beginning with "./"

原始碼與相關指南 ​

Released under the MIT License.