Search code examples
reactjstypescriptvercel

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.


Solution

  • 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"