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

307
Views
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 answers
Answer question

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 Report

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