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

302
Views
Error: no se encontró la exportación 'predeterminada' (importada como 'Swal') en 'sweetalert2' (el módulo no tiene exportaciones)

Estoy tratando de incluir sweetalert2 en mi proyecto Angular, pero da un error de tiempo de compilación. El error /src/app/pages/signup/signup.component.ts:29:16-25 - Error: exportar 'predeterminado' (importado como 'Swal') no se encontró en 'sweetalert2' (el módulo no tiene exportaciones)

paso a seguir

1. Instalar sweetalert2 2. Importar en el archivo .ts del componente (importar Swal desde 'sweetalert2') 3. Llamar usando Swal.fire()

/src/app/pages/signup/signup.component.ts:29:16-25 - Error: no se encontró la exportación 'predeterminada' (importada como 'Swal') en 'sweetalert2' (el módulo no tiene exportaciones)

alguien tiene solucion?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Tuve exactamente el mismo error, el problema era que estaba exportando el componente como:

 const Component = () => { Swal.fire({ //configs... }) export default Component;

Eliminé esa última línea y cambié a:

 export const Component = () => { Swal.fire({ //configs... })

Y todo empezó a funcionar de nuevo.

about 4 years ago · Juan Pablo Isaza Report

0

  1. Por lo tanto, primero debe asegurarse de incluir los archivos css y js necesarios en angular.json/angular-cli.json (dependiendo de su versión ng)
 "styles": [ "../node_modules/sweetalert2/dist/sweetalert2.css" ], "scripts": [ "../node_modules/sweetalert2/dist/sweetalert2.js", ],
  1. luego, en su componente, puede importarlo así
 import swal from "sweetalert2";
  1. Y en tu componente puedes usarlo así.
 swal({ type: 'success', title: 'your message', showConfirmButton: false, timer: 1500 });
about 4 years ago · Juan Pablo Isaza 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!