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

124
Views
Mejor manera de importar el complemento Vite

Recibo un error cuando sigo el uso de vite-plugin-plain-text :

 import plainText from 'vite-plugin-plain-text'; console.log(plainText); // Check what we imported. let config = plainText(/LICENSE$/);

La salida es:

 { default: [Function: plainText] } > plainTextPlugin is not a function

En lugar de importar una función, la declaración de importación importó un objeto con una función llamada default . En el archivo JS del módulo, el plainText se exportó así:

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

Pude importar con éxito así:

 import plainTextPlugin from 'vite-plugin-plain-text'; let plainText = plainTextPlugin.default; let config = plainText(/LICENSE$/);

¿Hay una forma más elegante de lograr esta importación? La hoja de trucos del módulo de JavaScript no tiene ningún patrón para importar una biblioteca que se exportó como esta biblioteca. Curiosamente, el código fuente de TS exporta el módulo de esta manera:

 export default function plainText (...)
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!