Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

516
Vistas
Uncaught TypeError: _vue2.default is not a constructor

I upgrade the vue to 3.x, when I run the app, shows error like this:

Uncaught TypeError: _vue2.default is not a constructor

I initial the app like this:

if ( process.env.NODE_ENV !== 'testing' ) {
  window.onload = ()=> {
    setTimeout( ()=> new Vue( appOptions ) , 0 );
  };
}

this is the full code:

import Vue from 'vue';
import template from './tpl.html';
import chromeCall from 'chrome-call';
import getOptions from '../public/default-options';
import {getTabLocation,isHostEnabled} from '../public/util';
import ST from './st';

    export const appOptions = {
      el : 'app' ,
      template ,
      data : {
        _host : null ,
        canInject : false ,
        enabled : false
      } ,
      methods : {
        async switchEnable() {
          const {_host} = this.$data ,
            enabled = this.enabled = !this.enabled ,
            {excludeDomains} = await getOptions( 'excludeDomains' );
    
          if ( enabled ) {
            excludeDomains.splice( excludeDomains.indexOf( _host ) , 1 );
          } else {
            excludeDomains.push( _host );
          }
          return chromeCall( 'storage.local.set' , { excludeDomains } );
        }
      } ,
      components : {
        'st-box' : ST
      } ,
      async ready() {
        const locationObj = await getTabLocation();
        if ( locationObj ) {
          this.$data._host = locationObj.host;
          this.canInject = true;
          this.enabled = await isHostEnabled( locationObj );
        }
      }
    };
    
    /* istanbul ignore if */
    if ( process.env.NODE_ENV !== 'testing' ) {
      window.onload = ()=> {
        setTimeout( ()=> new Vue( appOptions ) , 0 );
      };
    }

why did this happen? what should I do to fix this problem? I have tried to tweak the code like this:

if ( process.env.NODE_ENV !== 'testing' ) {
  window.onload = ()=> {
    setTimeout( ()=> Vue.createApp( appOptions ) , 0 );
  };
}

still did not fix this problem.

about 4 years ago · Juan Pablo Isaza
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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda