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

150
Views
No se puede importar el componente dinámicamente con el nombre/ruta del componente como variable

Inercia.js

Estoy tratando de importar un componente dinámicamente con el siguiente código donde this.component es igual a '@/Components/Form/Fields/Textarea'

 componentToDisplay() { return defineAsyncComponent(() => import(this.component + '.vue')) }

Pero me sale este error: " Error: No se puede encontrar el módulo '@/Components/Form/Fields/Textarea.vue' "

Si return defineAsyncComponent(() => import('@/Components/Form/Fields/Textarea.vue')) , funciona bien.

He visto a algunas personas hablar sobre cadenas literales, por eso agregué el + '.vue' en el primer ejemplo, pero incluso return defineAsyncComponent(() => import(this.component)) no funciona.

Estoy perdido, así que cualquier ayuda es apreciada, gracias.

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!