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

163
Vistas
TypeScript does not provide default export

I have problems with Laravel + Vite + Vue 3 project. I have installed everything as documentation and needed, and this project works separated from Laravel and Vite. But here is the problem, TypeScript doesn't recognize export default. It's always giving an error like:

MainLayout.vue:42 
        
       Uncaught SyntaxError: The requested module '/resources/scripts/composable/Auth.js' does not provide an export named 'default' (at MainLayout.vue:42:1)

But the Auth.ts file has exported function, and it looks like:

export default function useAuth(){
    return {
    CurrentUserToken: 'test';
  };
}

This is how I'm calling in some files (example)

import useAuth() from './Auth';

const { CurrentUserToken } = useAuth();


return CurrentUserToken;

Why it would not recognize this named function?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can export it like this

export function useAuth() {
    return {
    CurrentUserToken: 'test';
  };
}

Import

import { useAuth } from './Auth';

Execute the function

useAuth();

OR

If you want to export default

export default function() {
    return {
     CurrentUserToken: 'test';
  };
}

And import would look like this

import useAuth from './Auth';

Execute the function

useAuth();
about 4 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda