Nuxt throwing error : Uncaught TypeError: Cannot call a class as a function

Nuxt throwing error : Uncaught TypeError: Cannot call a class as a function

我在我的 Vuejs/Nuxtjs 应用程序中使用 drawflow npm library 但是当我启动该应用程序时,我的控制台出现以下错误:

classCallCheck.js:3 Uncaught TypeError: Cannot call a class as a function
    at _classCallCheck (classCallCheck.js:3)

以下是我根据文档遵循的步骤:

  1. 使用 npm i drawflow --save
  2. 安装 drawflow
  3. plugins文件夹下创建一个drawflow.js文件并添加代码:
import Vue from 'vue'
import Drwaflow from 'drawflow'
Vue.use(Drwaflow)
  1. 修改nuxt-config.js文件并添加plugin并构建:
plugins: [
    { src: "~/plugins/drawflow", mode:"client" }
  ],

  build: {
    transpile: ["drawflow"]
  },
  1. 我的 Vue ComponentMounted 函数中有以下内容:
  async mounted () {
    const vm = this

    if (process.browser) {
      const Drawflow = await require('drawflow')
      // const styleDrawflow = await require('drawflow/dist/drawflow.min.css')
      Vue.use(Drawflow)

      const id = document.getElementById('drawflow')
      console.log(id)
      vm.editor = new Drawflow(id, Vue, vm)
      vm.editor.start()
    }
  }

不明白这里出了什么问题。找不到 Nuxt 的任何相关 post。有人可以解释一下这段代码有什么问题吗?

即使这个问题可以通过更多的工作解决,最后,OP 希望让它在本地工作。
此用例的解决方案是 并从我的 PoV 开始工作。

因此,我不建议采用插件路径,以防止它在全球范围内的整个 SPA 上可用。