Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!