Polycompiler: Merge Python and JavaScript code into one file that runs in both
Published on: 2025-07-18 13:27:01
Polycompiler
See how it works on YouTube.
An experimental project to attempt to merge arbitrary Python and JS code into one source file.
For example, the following code prints Hello JS when run with Node, and Hello Python when run with Python 3.
1 // ( lambda : exec ( "print('Hello Python')" , globals ()) or 1 )() lambda : eval ( "console.log('Hello JS')" )
Installation & Use
Here's how you can get started with Polycompiler in a few simple steps.
Install polycompiler on NPM:
npm i polycompiler
Merge your files
Now, run the polycompiler command, providing the path to a JS file, a Python file, and an optional result file path.
When the output is run with Node.js : It will run your JS file
: It will run your JS file When the output is run with Python: It will run your Python file
polycompiler in.js in.py out.py.js
🚧 WIP: The current file convention for Polycompiler output file extension is .py.js . This is becuase Node refuses to parse files of other file extensions, so it h
... Read full article.