That is usually done with the build tags, for different OSes and arches, and TinyGo defines the tinygo build tag.