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

134
Visualizações
Built js module is importing an object with default property instead of importing the default

I'm creating a svelte-kit app with typescript, so it's internally using vite.

And I'm using next-auth's facebook provider (even though next-auth is for react, it's internal features can be jerry-rigged).

I'm importing the provider with import FacebookProvider from 'next-auth/providers/facebook';. This correctly imports the default function during development.

But when I actually build, I get FacebookProvider is not a function error. Debugging shows that FacebookProvider is now { default: [Function: Facebook] }.

I've also tried import * as FB from 'next-auth/providers/facebook'; and try to use FB.default. Same thing happened FB.default is now { default: [Function: Facebook] } when I build, which is quite bizarre. There are 2 nested defaults now. Any idea what's happening here?

Since I'm using typescript, this seems like a problem with compiled output js files. My tsconfig is pretty barebone, mostly inheriting the defaults from svelte-kit.

{
    "extends": "./.svelte-kit/tsconfig.json",
    "compilerOptions": {
        "baseUrl": ".",
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "paths": {
          "$lib": ["src/lib"],
          "$lib/*": ["src/lib/*"]
        }
    },
    "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
}

I've also looked at the source. next-auth is also using typescript and is just using export default as usual. I've also looked at the compiled js file. The way it's exporting is like so -

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports.default = Facebook;

Is there some known problem with import that I'm missing? Appreciate any help. Thanks!

about 4 years ago · Juan Pablo Isaza
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