-
@unormal found an article that explains a technique for using a Babel plugin to hack to something similar to what you want? Post is from 2017, so it probably doesn't work nowadays... medium.com/byteagenten/conditional-compilation-for-javascript-using-babel-5a6db5964422