• Empleos
  • Sobre nosotros
  • Empleos
    • Inicio
    • Empleos
    • Cursos y retos
  • Empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

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

I am using drawflow npm library in my Vuejs/Nuxtjs application but when I start the application I get the following error in my console:

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

Following are the steps I have followed as per documentation:

  1. Install the drawflow using npm i drawflow --save
  2. Create a drawflow.js file under plugins folder and add the code:
import Vue from 'vue'
import Drwaflow from 'drawflow'
Vue.use(Drwaflow)
  1. Modify the nuxt-config.js file and add the plugin and build:
plugins: [
    { src: "~/plugins/drawflow", mode:"client" }
  ],

  build: {
    transpile: ["drawflow"]
  },
  1. My Vue Component has following in Mounted function:
  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()
    }
  }

Not understand what's wrong here. Could not find any relevant post for Nuxt. Can someone please explain what's wrong with this code?

over 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Even if this question could work with some more work, at the end, OP wants to have it working locally.
The solution for this use case is available here and working from my PoV.

I hence do not recommend taking the plugins path to prevent having it available on the whole SPA globally.

over 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda