imports of modules and optimizes the logic of the code.
You can compare NodeJS to a PHP, Python, Java, or ASP.NET server: The code is optimized and compiled into an intermediate assembly language (called bytecode - similar to assembly ).
It is worth remembering that even if NodeJS and other languages have access to some functions of the machine or operating system, it is the virtual machine / interpreter of the language that runs this compiled code. That is, by default Java uses the Java Virtual Machine (JVM), PHP uses the PHP interpreter based on Zend Engine, Python uses the Python interpreter of its distribution (Jython, IronPython, CPython, PyPy) and ASP.NET uses the CLR of the .NET Framework.
It is interpreted and then compiled "on the fly" JIT with V8.