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
Conflicto entre baseUrl y node_modules al importar

Tengo un proyecto TS con la siguiente configuración:

tsconfig.json (parcial)

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

Tengo una dependencia en el paquete stripe NPM:

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

Entonces tengo los siguientes archivos:

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

Tengo algunos problemas con las importaciones en src/routes/payments/index.ts . Quiero importar la biblioteca de stripe , no mi propio código.

Esto funciona:

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

Esto no funciona:

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

Obtuve el siguiente error:

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

¿Cómo elimino la ambigüedad y le digo a TS que quiero usar stripe de node_modules?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

¿Puedes intentar actualizar el archivo tsconfig.json de esta manera:

 { "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!