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

162
Visualizações
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 Respostas
Responde à pergunta

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 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