Typescript vercel部署无法要求“.d.ts”文件
我的next.js应用程序可以在我的机器上运行,但在Vercel上部署时,它在生成时失败,出现以下错误:Typescript vercel部署无法要求“.d.ts”文件,typescript,next.js,vercel,Typescript,Next.js,Vercel,我的next.js应用程序可以在我的机器上运行,但在Vercel上部署时,它在生成时失败,出现以下错误: Error! Unable to require `.d.ts` file. This is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or another executable extension and loader (attached befor
Error! Unable to require `.d.ts` file.
This is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or another executable extension and loader (attached before `ts-node`) available alongside `emotion.d.ts`.
它似乎无法在我的“类型”文件夹中检测到情感。它位于src-like/src/types/emotion.d.ts中,因此我尝试更改我的设置以包含它,如下所示
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": [
"next-env.d.ts",
"src/**/*"
],
"exclude": [
"node_modules"
]
}
不过,运气不好
我的emotion.d.ts文件只是声明了这样一个类型
import '@emotion/react';
declare module '@emotion/react' {
export interface Theme {
color: {
primary0: string;
primary1: string;
primary2: string;
primary3: string;
primary4: string;
primary5: string;
primary6: string;
primary7: string;
secondary0: string;
secondary1: string;
secondary2: string;
secondary3: string;
secondary4: string;
secondary5: string;
secondary6: string;
tertiary0: string;
tertiary1: string;
tertiary2: string;
text0: string;
text1: string;
text2: string;
text3: string;
text4: string;
bg0: string;
bg1: string;
bg2: string;
};
size: {
maxWidth: string;
};
mediaQuery: {
sp: string;
pc: string;
};
}
}
任何帮助都将不胜感激。谢谢大家! 尝试将
emotion.d.ts
添加到tsconfig中的include
属性,我会的。非常感谢。