Next.JS 中的 Typescript 文件重命名后在 Vercel 上构建错误
Build error on Vercel after Typescript file in Next.JS renamed
我有时间选项,可以导出到名为 TimeOptions 的特定文件,其中我有这样的 Intl.DateFormat
代码
当我将文件从 TimeOptions
重命名为 timeOptions
时,Vercel 在构建时告诉我 Type 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"
我有时间选项,可以导出到名为 TimeOptions 的特定文件,其中我有这样的 Intl.DateFormat
代码
当我将文件从 TimeOptions
重命名为 timeOptions
时,Vercel 在构建时告诉我 Type 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"