I was running Next.js with Vercel, but after putting in certain commits, I got a build error.
「Type error: Cannot find module './components/Article' or its corresponding type declarations.」
The build succeeds locally.
yarn build
I stepped in and investigated the GitHub and source code that Vercel builds as suspicious.
目次
Cause : The file name on GitHub was different from the file name in the source.
The cause was that the filenames on GitHub had different case and could no longer be referenced.
I’m disappointed that Git does not detect filename case changes by default.
Commit the case of file names to Git.
Use git mv.
git mv {current file name} {update file name}
git mv ./components/article ./components/Article
You can commit.
Detecting filename case changes in Git
Ensure that changes can be detected next time.
Check the current status in git config and when core.ignorecase = true, case changes are not detected.
This is the Git default.
$ git config -l --local | grep core.ignorecase
core.ignorecase=true
Setting it to false enables case changes to be detected.
$ git config core.ignorecase false
Summary
Taking measures to avoid making the same mistakes is also necessary to have a comfortable development life.