You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow special characters in path and filenames #4624
Next.js is the defacto solution for creating dynamic React.js websites. It allows to easily create applications and fine-tune where rendering happens (client or server). ReScript would be a great match here to provide typesafety in these solutions. Some great work has been done by https://github.com/mrmurphy/reason-nextjs already but a large painpoint remains.
Next.js uses special characters such as [id] and [...slug] in the pathnames and filenames of files in the pages/ directory. These are variable placeholders that are used for route arguments. Documentation for this can be found here: https://nextjs.org/docs/routing/dynamic-routes
Requested change
By allowing special characters (specifically those used by Next.js routing) in path and filenames, integration with the Next.js framework would be greatly simplified. This could be put behind configuration that limits it to a specific folder that may not be used as module imports (to work around the module naming limitation).
hi @Kingdutch we will relax the name a little bit to allow, 404.ml.
We need some more input that which names are desired to be allowed
Note that you still can not access it due to syntax restriction.
@bobzhang you can see in the Next.js Dynamic Routes documentation how they use [, ], and . in the filename and then map this to arguments in the URL and query parameters in the component.
The current Next.js bindings recommend using symlinks to get the correct filename. However, this is not a great experience when working with git or deploying to platforms where it's uncertain if symlinks are available. So allowing the caracters []. in a ReScript filename would mean we can work without symlinks and use the BuckleScript output directly.
@supriyo can you check if #4690 covers all your cases
Note this is experimental, we may apply restrictions back if there are some conflicts we don't recognize yet
@bobzhang From reading the PR it looks good to me. I don't have a ReScript Next.js repository nearby to test the individual files unfortunately. I could do so later this week.
I'm at Spanish speaker, so many of the thing that I make are in Spanish. I was working on at product list and thoses routes that include "´" and "ñ" like navegación, niños, técnico and like so, don't get to be render. How can i aproach to this in future projects?
Activity
bobzhang commentedon Aug 14, 2020
note we currently support something like this
[@@@bs.config { no_export} ]if we add a payload in no_export to change filename, would that be enough?
It will generate "123.js"
Kingdutch commentedon Aug 14, 2020
Ooh interesting! Does this prevent Reason exports only? There are exports required in the JavaScript code for the page components
bobzhang commentedon Sep 10, 2020
hi @Kingdutch we will relax the name a little bit to allow, 404.ml.
We need some more input that which names are desired to be allowed
Note that you still can not access it due to syntax restriction.
Partially address #4624 (allow names like 404.ml); better handling em…
bobzhang commentedon Sep 10, 2020
see #4685
Merge pull request #4685 from rescript-lang/fix_sys_directory
Kingdutch commentedon Sep 10, 2020
Thanks @bobzhang I think allowing numbers is a cool first step. It mostly helps with error pages (404, 500, etc.) :D
The game-changer here would still be adding support for
[,], and.though so that URL arguments can be specified :DNot being able to access these modules is fine as you're not supposed to access Next.js or Page components from other files anyway.
bobzhang commentedon Sep 10, 2020
#1436 we could also support Button.Android.res
Where could I find file names using
[,]?Kingdutch commentedon Sep 10, 2020
@bobzhang you can see in the Next.js Dynamic Routes documentation how they use
[,], and.in the filename and then map this to arguments in the URL and query parameters in the component.The current Next.js bindings recommend using symlinks to get the correct filename. However, this is not a great experience when working with git or deploying to platforms where it's uncertain if symlinks are available. So allowing the caracters
[].in a ReScript filename would mean we can work without symlinks and use the BuckleScript output directly.bobzhang commentedon Sep 12, 2020
supriyo commentedon Sep 14, 2020
@bobzhang Here is a list of file name examples to support that would make working with nextjs easier:
bobzhang commentedon Sep 15, 2020
@supriyo can you check if #4690 covers all your cases
Note this is experimental, we may apply restrictions back if there are some conflicts we don't recognize yet
Kingdutch commentedon Sep 15, 2020
@bobzhang From reading the PR it looks good to me. I don't have a ReScript Next.js repository nearby to test the individual files unfortunately. I could do so later this week.
supriyo commentedon Sep 15, 2020
@bobzhang That looks good to me too. This is will be really helpful. Thanks!
bobzhang commentedon Sep 17, 2020
experimental support landed in master
JanDez commentedon Jun 24, 2021
I'm at Spanish speaker, so many of the thing that I make are in Spanish. I was working on at product list and thoses routes that include "´" and "ñ" like navegación, niños, técnico and like so, don't get to be render. How can i aproach to this in future projects?