简体   繁体   English

Next.JS 中的 Typescript 文件重命名后,Vercel 上的构建错误

[英]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我有时间选项,可以导出到名为 TimeOptions 的特定文件,其中有这样的Intl.DateFormat代码在此处输入图像描述

When I rename the file from TimeOptions to timeOptions , Vercel told that Type error: Cannot find module '../utils/timeOptions' or its corresponding type declarations.当我将文件从TimeOptions重命名为timeOptions时,Vercel 告诉Type error: Cannot find module '../utils/timeOptions' or its corresponding type declarations. on build.在构建。

在此处输入图像描述

When I built it locally with next build , the results looks fine and no error.当我使用next build在本地构建它时,结果看起来很好并且没有错误。

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.我已尝试按照其他线程中的说明设置tsconfig.js ,但在 Vercel 上似乎没有任何效果。

Here I attach the tsconfig file.这里我附上 tsconfig 文件。 在此处输入图像描述

Thank you very much for your kind help.非常感谢您的帮助。

It's caused by git not being case sensitive on file naming and not picking up your change.这是由于 git 在文件命名上不区分大小写并且不接受您的更改引起的。

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"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM