sweetalert2 (npm, github) versions >= 11.4.9 is affected by a protestware behavior (war propaganda).
- What is a protestware?
- Snyk report of Undesired Behavior
- Introduction of the propaganda message
- Evolution of the propaganda in version 11.4.20
So here is a quick and easy way to disable this behavior if you use sweetalert2 >= 11.4.20 and gulp.
Install gulp-replace
module:
$ npm install --save-dev gulp-replace
Modify your sweetalert2 deployment task in gulpfile.js
:
+const replace = require('gulp-replace');
...
function sweetalert2() {
return src('node_modules/sweetalert2/dist/sweetalert2.all.min.js')
+ .pipe(replace('Math.random()<.1', 'Math.random()<0'))
.pipe(dest('build/js/vendor/sweetalert2/'));
};
As you can see below, the behavior has 10% chance of occuring
But by modifying it to Math.random()<0
it will always be false and will never occurs.