Next.js: Production build next/link href is case sensitive, dev next/link case insensitive

Created on 22 Sep 2019  路  5Comments  路  Source: vercel/next.js

Bug report

It seems that building a next app for production requires al Link hrefs to be case sensitive where in dev environment these are not case sensitive.

To Reproduce

  1. Create some pages in the pages directory:

e.g

-pages
|-- index.js
|-- folder
|--page1.js
|--Page2.js

In the app have all hrefs of link in the following style: "/folder/page[1/2]".
All links will work in dev but only the page 1 link will work in production.

Expected behavior

I would expect to either have them case sensitive in dev and production or case insensitive in dev and production. Like this it is very hard to isolate the error as it is "Why is non of my pages loading in production but all of them work in dev".

System information

  • OS: macOS
  • Browser: Tested in Chrome and Safari
  • Version of Next.js: 9.0.5

+Edit: Wanted to also quickly add a small thank you note for next. Great stuff, thanks!

needs investigation

Most helpful comment

Related follow-up: Is there a recommended way of making links case insensitive in production on a Linux server? E.g. I'd like users to be able to go to either "/About" or "/about" and have it load the same page.

Obviously, one option that comes to mind would be to create an About.jsx as well as an about.jsx under the pages directory, but this isn't allowed on MacOS (which I'm using to develop locally) because the filesystem is case insensitive.

Thanks!

All 5 comments

macOS filesystem is case insensitive. your production environment filesystem might not be. it might have to do with your platform rather than with next.js?

Ah did not think about that - makes sense though. Noting: Both executed on the same local machine. So there is no difference between production and dev environment.

Hi! I'd like to work on this issue. Could you assign me?

@kgabryje There is already a PR for this https://github.com/zeit/next.js/pull/8848

Related follow-up: Is there a recommended way of making links case insensitive in production on a Linux server? E.g. I'd like users to be able to go to either "/About" or "/about" and have it load the same page.

Obviously, one option that comes to mind would be to create an About.jsx as well as an about.jsx under the pages directory, but this isn't allowed on MacOS (which I'm using to develop locally) because the filesystem is case insensitive.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings