Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

510
Visualizações
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?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

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.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda