The bower package of Sweet Alert forces you to use webpack. You’ll see errors with “require null” or something like that.
Step 1 - Use the Yii2 package
Install this package using composer.
Step 2 - Instead of the widget add the asset manager, that aryelds already made for you.
use aryelds\sweetalert\SweetAlertAsset; SweetAlertAsset::register($this);
Step 3 - Add it into your js
swal("Oh NO", "You have a error!", "error");