the two files might share a name, but they are written in different languages, thus serving different purpose.
PS: index is a naming convention, but beside that, many tools would target that name by default. For example, if you want to import a file from a given folder, using JS, if you dont provide a file name, the file named ‘index’ will be targeted by default.
Just as a word of warning: this is explicitly not default behaviour, it’s just how some tools work, as a convenience. JS requires fully resolved file names. It’ll work in something like the environment that this project is being developed in, and it’ll work fine (I rely on this behaviour quite a lot). But if you use actual JS modules, eg in a browser environment, this will just fail, because there’s no file specified, so there’s nothing to import
It is how Node resolves CommonJS file imports. If there isn’t a configuration set that specifies which file to look for first, then it will default to using index.js if there is a file of that name in the folder it’s searching in. And most current build tools use Node, so they’ve inherited this behaviour.