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

105
Views
Conflict between baseUrl and node_modules when importing

I have a TS project with the following configuration:

tsconfig.json (partial)

{
  "compilerOptions": {
    "module": "commonjs",
    "baseUrl": "src",
    "esModuleInterop": true,
  },
  "include": [
    "src"
  ]
}

I have a dependency on the stripe NPM package:

{
  // ...
  "dependencies": {
    "stripe": "^8.45.0",
  }
}

Then I have the following files:

src/routes/payments/index.ts
src/stripe/index.ts

I am having some trouble with imports in src/routes/payments/index.ts. I want to import the stripe library, not my own code.

This works:

// Uses me the 'Stripe' constructor which is the default export from the package
const stripe = require('stripe')('KEY');

This does not work:

import Stripe from 'stripe';
const stripe = new Stripe('KEY');

I get the following error:

Module '"PROJECT/src/stripe/index"' has no default export.

How do I disambiguate and tell TS I want to use stripe from node_modules?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Can you try to update the tsconfig.json file like this:

{
 "compilerOptions": {
    "module": "commonjs",
    "esModuleInterop": true,
    "baseUrl": ".",
    "paths": {
      "*": [
        "node_modules/*",
        "src/*"
      ]
    }
  }
}
over 4 years ago · Santiago Trujillo Report
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!