Skip to content

If the filename is not a valid module name, allow multiple files with the same name #4874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jfrolich opened this issue Dec 16, 2020 · 8 comments
Labels
stale Old issues that went stale

Comments

@jfrolich
Copy link

This is helpful for NextJS. We can now have the filename [slug].res however that file can have multiple instances when using NextJS. Because the module is not accessible from the outside, it would be nice if the compiler allowed for multiple files with that name.

@bobzhang
Copy link
Member

what's the current work around, create [slug].js as a wrapper?

@jfrolich
Copy link
Author

yes or change the attribute name like [blogSlug].res

@ghost
Copy link

ghost commented Apr 29, 2021

Does the team have a rough estimate of when it would consider starting to work on this, if at all?

@jfrolich
Copy link
Author

jfrolich commented Apr 30, 2021

Proposed implementation, the module name can include a hash of the content (or based on another stable thing like the relative path of the file). When adding these characters to the filename the module is not accessible internally anyway.

@ghost
Copy link

ghost commented Apr 30, 2021

My use cases is very similar to the original statement, but the typical example doesn't need to use [slug].res. I encounter the same issue with: index.res and subdir/index.res.

@ghost
Copy link

ghost commented Jun 9, 2021

I'm trying to use the optional catch all pattern, and I'm running into the following error:

bsb: [169/174] pages/[[...index]]-Ocamlorg.cmj
FAILED: pages/[[...index]]-Ocamlorg.cmj

  We've found a bug for you!
  /pages/[[...index]].res
  
  Could not find the .cmi file for interface
  /pages/[[...index]].mli.

Did I encounter some illegal character issue?

@stale
Copy link

stale bot commented May 30, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Old issues that went stale label May 30, 2023
@stale stale bot closed this as completed Jun 10, 2023
@CarlOlson
Copy link

CarlOlson commented Jun 12, 2023

This would still be very helpful for NextJs app directory. Now that we have async and directives, this task is the only thing that prevents a ReScript-only NextJs app directory project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Old issues that went stale
Projects
None yet
Development

No branches or pull requests

3 participants