The way it works is that the new compiler produces an "Intermediate Representation" (or IR) of the code (Abstract Syntax Tree). This code is platform independent and is then compiled to whatever you want (JVM, JS, Native…). If you want to see what the IR looks like:
https://blog.bnorm.dev/writing-your-second-compiler-plugin-part-2 has some insights. These slides (in russian, but pictures and code may be enough can help as well).