Next.js: Next.js should enforce case sensitivity even if OS doesn't

Created on 8 Apr 2020  路  9Comments  路  Source: vercel/next.js

Bug report

Describe the bug

User churn due to:

Module not found: Can't resolve 'next/Head' in '/zeit/628124c9/pages'

To Reproduce

Import next/Head on a case insensitive filesystem and it will work.
Deploy to a sensitive one, it'll fail to build.

Expected behavior

Next.js should never of allowed the build in the first place and suggested the user fix the case sensitivity issue.

story 3

Most helpful comment

@utiq Thanks a lot for the code. I actually took out the --global flag and it worked perfectly.

All 9 comments

this PR won't fix this exact case, but it seems related.
馃 This may be solvable with with a linter as well. Or with case-sensitive-paths-webpack-plugin

Switching this from a bug to feature request due to your PR landing @Janpot 馃檹

I was having the same kind of error:
Module not found: Can't resolve '../../../components/Trends' in '/vercel/3e42d29f/pages/country/[category]'

Not sure what I actually did wrong here, even though I'm pretty sure I used correct casing for the component file.

@CallmeHongmaybe Same issue, how did you solve it?

I think this could be useful.

isEnvDevelopment && new CaseSensitivePathsPlugin(),

https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/webpack.config.js#L660

@utiq I actually haven't solved this yet.

So I'm just gonna put the CaseSensitivePathsPlugin somewhere in next.config.js amirite

I solved my problem, in my case it was my git configuration, I run this:
git config --global core.ignorecase false

@utiq Thanks a lot for the code. I actually took out the --global flag and it worked perfectly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lixiaoyan picture lixiaoyan  路  3Comments

DvirSh picture DvirSh  路  3Comments

timneutkens picture timneutkens  路  3Comments

jesselee34 picture jesselee34  路  3Comments

havefive picture havefive  路  3Comments