question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

js error like ''sweetalert2.default is not a function''

See original GitHub issue

below is my implementation:

import SweetAlert from 'sweetalert2'
SweetAlert('hello test')

I installed it by npm install and pretty sure ‘sweetalert2’ folder is ialready nside node_modules/ folder but that will cause js error like ‘sweetalert2.default is not a function’

No idea how to fix it (I previously used the original version of sweetalert but it works well in such way).

Thanks~

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
limontecommented, May 15, 2016

I just released v3.0.0

1reaction
limontecommented, Jun 6, 2016

@Tonkpils

Also any reason we’re depending on that particular version of es6-promise-polyfill instead of the more popular one es6-promise or rsvp.js?

Switched to es6-promise: https://github.com/limonte/sweetalert2/commit/b7a6a0dec56323c5de4342e907f00e5290d8f3ac

Read more comments on GitHub >

github_iconTop Results From Across the Web

sweetalert2_react_content_1.default is not a function - Stack ...
I want to use html within a Swal-component, and that just doesn't work. Here is my code: import Swal from "sweetalert2"; import withReactContent ......
Read more >
SweetAlert2 (Swal is not defined) How to solve? - jQuery Forum
When I click the button, no action is taken. On the "Console" I get the following message: "Uncaught ReferenceError: Swal is not defined"....
Read more >
Sweet Alert - Common Style Inventory
Here's a comparison of a standard error message. The first one uses the built-in alert-function, while the second is using sweetAlert.
Read more >
SweetAlert2 (Advance version of SweetAlert) - GeeksforGeeks
The sweet JS Provides easy methods to design and add a lot of functionality to the alert box of the website by just...
Read more >
SweetAlert2 - a beautiful, responsive, customizable and ...
A beautiful, responsive, customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found