I'm using sweetify gem to add sweetalert2 to my rails 6 app, but I'm getting this error
Uncaught ReferenceError: Swal is not defined
I added the following code to the environment.js file
environment.plugins.append('Provide', new webpack.ProvidePlugin({
sweetalert2: 'sweetalert2/dist/sweetalert2.all',
Swal: 'sweetalert2/dist/sweetalert2.all'
}));
and I do require it in the application.js file as the following
require("sweetalert2")
the sweetify gem add the below code before the end of the tag
<script>
Swal.fire({"showConfirmButton":true,"timer":null,"allowOutsideClick":false,"confirmButtonText":"Try again","type":"error","text":"there was a problem saving your Information, please try again","title":"Oops..."})
</script>
I don't know what I'm missing.
Any help is highly appreciated