Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

305
Vistas
Error: export 'default' (imported as 'Swal') was not found in 'sweetalert2' (module has no exports)

I am trying to include sweetalert2 in my Angular project, but it gives compile time error. The error /src/app/pages/signup/signup.component.ts:29:16-25 - Error: export 'default' (imported as 'Swal') was not found in 'sweetalert2' (module has no exports)

step follow

1.install sweetalert2 2.import on component .ts file (import Swal from 'sweetalert2') 3.call by using Swal.fire()

/src/app/pages/signup/signup.component.ts:29:16-25 - Error: export 'default' (imported as 'Swal') was not found in 'sweetalert2' (module has no exports)

anyone having solution?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

I had this exact same error, problem was that I was exporting the component as:

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

export default Component;

I deleted that last line and changed to:

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

And everything started to work again.

about 4 years ago · Juan Pablo Isaza Denunciar

0

  1. So you need to first make sure of that you are including the required css & js files in angular.json/angular-cli.json (depending upon your ng version)
  "styles": [
        "../node_modules/sweetalert2/dist/sweetalert2.css"
      ],
      "scripts": [
        "../node_modules/sweetalert2/dist/sweetalert2.js",
      ],
  1. then, in your component, you can import it like this
import swal from "sweetalert2";
  1. And in your component you can use it like this
swal({
     type: 'success',
     title: 'your message',
     showConfirmButton: false,
     timer: 1500
   });
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda