That is one way to do it, and it certainly is simple. However, you're still shipping the code that makes those calls in the first place.
To address that, one could take advantage of the bundling process to strip out all those calls in the first place. For example, it looks like UglifyJS supports conditional compiling that will help with that.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That is one way to do it, and it certainly is simple. However, you're still shipping the code that makes those calls in the first place.
To address that, one could take advantage of the bundling process to strip out all those calls in the first place. For example, it looks like UglifyJS supports conditional compiling that will help with that.