rony
rony

Reputation: 520

Build error on Vercel after Typescript file in Next.JS renamed

I have time options that I export to specific files named TimeOptions where I have Intl.DateFormat code like this enter image description here

When I rename the file from TimeOptions to timeOptions, Vercel told that Type error: Cannot find module '../utils/timeOptions' or its corresponding type declarations. on build.

enter image description here

When I built it locally with next build, the results looks fine and no error.

Do you know what's happened? I have tried to setup tsconfig.js as mentioned in other threads but nothing seems to work on Vercel.

Here I attach the tsconfig file. enter image description here

Thank you very much for your kind help.

Upvotes: 3

Views: 1547

Answers (2)

kaplya
kaplya

Reputation: 239

Its true, this is because git by default is case insensitive for filenames. To fix this, go to your git config and change ignorecase = false param. Or run the command git config core.ignorecase false

Upvotes: 4

Peter Trizuliak
Peter Trizuliak

Reputation: 126

It's caused by git not being case sensitive on file naming and not picking up your change.

You can fix it like this:

mv timeOptions.ts temp.ts
git add -A
git commit -m "renaming..."
mv temp.ts TimeOptions.ts
git add -A
git commit --amend -m "Rename timeOptions.ts to TimeOptions.ts"

Upvotes: 11

Related Questions