If you need to pass the constant number or boolean values in UglifyJS –define option, it is very easy. The tricky part is passing the string constant. Here is a quick code snippet to show how to pass string constant.
uglifyjs "test.js" --define STRCONST='"hello is a const string"' --output "build.min.js"
The correct sequence is single quote + double quote + your string + double quote + single quote
Leave a Reply