What do you think about adding a standalone attribute for setting output filename?

The filenames of the output JS files have been a nightmare when using filesystem routing and managing .test files. I believe that the problem originates from the fact that we force the output file name to match the original source file name. However, if we can set the filename of the output JS file separated from the original source file name, it’d be very straightforward to handle all the filename issues we currently have. I expect to put something like @@filename("page.jsx") at the top of the file. Is there anything blocking us from moving this way?

3 Likes

You can use plain JS or TS with genType for page components, tests, etc

I know that workaround, but I don’t think that’s an elegant solution that can be recommended generally, especially for newcomers.

Maybe true, but it should be supported in terms of configuration, not part of the language.

eg. in the configuration framework you already use. You can already customize the filename convention for input files in test frameworks like Jest. It is generally preferred as the language cannot be tailored to all consumers.

(Next.js cannot customize filename convention for page comp. But… why?)

If ReScript will add first-class support for it, it should be archived by extending the bsconfig IMO.