// main.js / main.ts (the filename doesn't matter) function main() { console.log("Hello world"); } if (require.main === module) { main(); }