I have been a Windows user for all my life but decided to get a M1 mac specifically. I understand M1 Macs use a different chipset so im used to finding software installers(like Chrome, Firefox, etc) that have M1-based installers.
Today I noticed Discord does not have that and you check that based on the URL
The screenshot above was taken on a Windows but I noticed the URL is all the same.
I know Discord is based on ElectronJS but don't you have to compile your program to the chipset you wish to serve? [Never used ElectronJS, just taking a guess]
How does Discord do that?
On NeXT-based system such as macOS (and all other Apple OS's), a binary can contain code for multiple architectures. Apple calls this a Universal Binary and it was already used in the PowerPC to Intel transition, and then again in the Intel to Arm transition. Basically, the compiler generates executables for multiple architecture and then combines them into a single file. The OS then picks the appropriate part for the current architecture at runtime.
When you download the Discord app and just mount the disk image, here's what you get when you run file
on the main executable:
$ file /Volumes/Discord/Discord.app/Contents/MacOS/Discord
/Volumes/Discord/Discord.app/Contents/MacOS/Discord: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64
- Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64
- Mach-O 64-bit executable arm64]
/Volumes/Discord/Discord.app/Contents/MacOS/Discord (for architecture x86_64): Mach-O 64-bit executable x86_64
/Volumes/Discord/Discord.app/Contents/MacOS/Discord (for architecture arm64): Mach-O 64-bit executable arm64
You can see that the binary contains code for both the x86_64 and arm64 architectures. A fat binary can contain an arbitrary number of supported architectures, a few years ago it was not uncommon to have iOS libraries compiled for multiple ARM flavors (ARMv7, ARMv8, ARM64) and Intel flavors (i386, x86_64, for the iOS Simulator).