重命名Next.JS中的Typescript文件后,在Vercel上构建错误
我有时间选项可以导出到名为 TimeOptions 的特定文件,其中我有这样的Intl.DateFormat代码
当我将文件从TimeOptionsto重命名时timeOptions,VercelType error: Cannot find module '../utils/timeOptions' or its corresponding type declarations.在构建时告诉了这一点。
当我在本地使用 构建它时next build,结果看起来不错,没有错误。
你知道发生了什么事吗?我曾尝试tsconfig.js按照其他线程中提到的方式进行设置,但在 Vercel 上似乎没有任何效果。
这里我附上 tsconfig 文件。
非常感谢您的帮助。
回答
这是由于 git 对文件命名不区分大小写并且不接受您的更改造成的。
你可以像这样修复它:
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"
THE END
二维码