Loving unique filenames

Hey, I was just scratching my head over how to handle the fact that non-unique filenames aren’t allowed in ReScript projects.

Especially for Next.js projects, this can be problematic (for those of you who don’t know Next.js - it uses filenames to set up automatic routing). I would love for some kind of feature we tell the ReScript compiler that “this file is private, it’s not exporting anything and is intended to be used as is where it is, so don’t include it in the global scope and don’t care about it’s filename”.

Beyond that, I had a ReScript projects with dirs for namespacing. I just read some post by someone on this forum. Inspired what was said, I moved EVERYTHING to the root of the project, keeping a flat hierarchy - or rather anarchy. I’m absolutely loving it. It’s back to my days of coding C++ during the 90’s - we used to keep projects flat back then.

This makes SO much sense for understanding project composition. Screw directories - I was blinded thinking I have to have an elaborate folder structure (this was bashed into my head over and over during the early 2000’s - the .NET OO era). NO! I need clear filenames and less hierarchy. :heart_eyes:

7 Likes

This way you can give proper names for your ReScript components, that’s not restricted by NextJs routing. Also, it’ll allow you easily switch a routing library if you need it for some reason.

1 Like