Reputation: 5968
I have a web page and I'm trying to add an external library:
<script async src="somepath/sweetalert2.all.min.js"></script>
The web page contains already some other libraries added by my framework (which is Oracle Apex) and that I don't control.
However I'm getting the error : (screenshot)
Uncaught Error: Mismatched anonymous define() module
I'm not a JavaScript guy, so I don't know how to add this library without getting this error.
Can anyone help please?
Upvotes: 3
Views: 7100
Reputation: 14904
You need to load it with require instead of with script
Somewhere you should have an requirejs-config.js
file. There you need to add your script:
var config = {
map: {
sweetalert: "js/sweetalert"
}
}
The key is your name, and the value is the path to the script Now you can use it like this:
require(["sweetalert"], function(){
swal("Good job!", "You clicked the button!", "success");
});
This should be enough
Upvotes: 2