So I wanted to build a project using NextJs + Rescript, but the issue is that in rescript you can’t have the same file name, which conflicts with the NextJs folder structure (wherein inside each folder you are needed to have a page.js file to help define the pages). To solve this issue we can have a mix of Js and res files, wherein we are importing the rescript generated components in the page.js file. But I wanted to be consistent and have all my logic in res file, so when I was going though the docs I came across js-post-build config wherein you can define a post build script and so I thought to run a script that renames the compile Something_Page.res.js file to page.res.js (i.e., add a condition saying if the file name has a substring _Page then rename it to page.res.js file). But I don’t know how the filename inside the script to check and rename. And I’m not even able to run a simple script, I guess there’s some issue with the path. Can someone please help me with this. There’s no much docs about the js-post-build config, and if any alternate work around also works.
I’m getting an error when I try to add the js-post-build config. When I’m removing this config then its compiling successfully. Can you please help me with this?