itchy-amethyst
itchy-amethyst6mo ago

Vercel deployment failing

Forked my own copy of the app-crm template, made a few customizations and now looking to deploy to vercel but I keep getting this error from them: error TS6305: Output file '/vercel/path0/app-crm/vite.config.d.ts' has not been built from source file '/vercel/path0/app-crm/vite.config.ts'. The file is in the program because: Matched by include pattern 'vite.config.ts' in '/vercel/path0/app-crm/tsconfig.json' Error: Command "npm run build" exited with 2
8 Replies
kapa.ai
kapa.ai6mo ago
Hi @Luke. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, it seems like the issue might be related to TypeScript configuration or build process. You might want to check the tsconfig.json and ensure that the vite.config.ts file is correctly included and compiled. For more detailed guidance, you can refer to the Refine documentation (https://refine.dev/docs) or the Vercel documentation (https://vercel.com/docs). If you continue to face issues, you might find it helpful to look at the example projects provided by Refine, such as the starter-vite example (https://github.com/refinedev/refine/blob/master/examples/starter-vite/README.md) or other similar projects to compare configurations. Additionally, you can try running the build command locally to see if the issue persists outside of Vercel. This might give you more insight into what might be going wrong. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai6mo ago
<@918590213448675382> kapa.ai is still learning and improving, please let us know how it did by reacting below
itchy-amethyst
itchy-amethystOP6mo ago
@kapa.ai here's my tsconfig.json { "compilerOptions": { "target": "ESNext", "useDefineForClassFields": true, "lib": [ "DOM", "DOM.Iterable", "ESNext" ], "allowJs": false, "skipLibCheck": true, "esModuleInterop": false, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "module": "ESNext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx", "baseUrl": "./src", "paths": { "@/": [ "./" ] } }, "include": [ "src", "./vite.config.ts" ], "references": [ { "path": "./tsconfig.node.json" } ] }
kapa.ai
kapa.ai6mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Based on the error message and your tsconfig.json file, it seems like the issue might be related to the inclusion and compilation of the vite.config.ts file. The error indicates that the vite.config.d.ts file has not been built from the source file vite.config.ts. Here are a few steps you can take to resolve this issue: 1. Check the noEmit Option: The noEmit option in your tsconfig.json is set to true, which means TypeScript will not emit any output files. This could be causing the issue since Vercel expects the vite.config.d.ts file to be generated. You might want to set noEmit to false or remove it to allow TypeScript to generate the necessary files. 2. Ensure Proper Compilation: Make sure that the vite.config.ts file is being properly compiled. You can try running the TypeScript compiler locally to see if it generates the vite.config.d.ts file:
tsc --project tsconfig.json

tsc --project tsconfig.json

3. Vercel Configuration: Ensure that your Vercel configuration is set up correctly to handle TypeScript files. You might need to add a build step in your vercel.json file to compile TypeScript before running the build command. Here is an updated version of your tsconfig.json with noEmit set to false:
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": false, // Changed from true to false
"jsx": "react-jsx",
"baseUrl": "./src",
"paths": {
"@/*": [
"./*"
]
}
},
"include": [
"src",
"./vite.config.ts"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
{
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": false, // Changed from true to false
"jsx": "react-jsx",
"baseUrl": "./src",
"paths": {
"@/*": [
"./*"
]
}
},
"include": [
"src",
"./vite.config.ts"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
After making this change, try deploying to Vercel again. If the issue persists, you might want to refer to the Vercel documentation (https://vercel.com/docs) for more detailed guidance on deploying TypeScript projects. For more information on configuring TypeScript in Refine, you can check the Refine documentation (https://refine.dev/docs). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai6mo ago
<@918590213448675382> kapa.ai is still learning and improving, please let us know how it did by reacting below
itchy-amethyst
itchy-amethystOP6mo ago
okay @kapa.ai I made those changes and still get this error from Vercel: " tsc --project tsconfig.build.json && cross-env NODE_OPTIONS=--max_old_space_size=4096 refine build error TS5058: The specified path does not exist: 'tsconfig.build.json'. Error: Command "npm run build" exited with 1 "
kapa.ai
kapa.ai6mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- It looks like Vercel is trying to use a tsconfig.build.json file that doesn't exist in your project. To resolve this, you can either create a tsconfig.build.json file or modify your build command to use the existing tsconfig.json. Option 1: Create a tsconfig.build.json File You can create a tsconfig.build.json file with the necessary configuration. Here is an example:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false,
"outDir": "./dist"
},
"include": [
"src",
"./vite.config.ts"
]
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false,
"outDir": "./dist"
},
"include": [
"src",
"./vite.config.ts"
]
}
This file extends your existing tsconfig.json and ensures that TypeScript will emit the compiled files. Option 2: Modify the Build Command Alternatively, you can modify your build command to use the existing tsconfig.json file. Update your build script in package.json to:
"scripts": {
"build": "tsc --project tsconfig.json && cross-env NODE_OPTIONS=--max_old_space_size=4096 refine build"
}
"scripts": {
"build": "tsc --project tsconfig.json && cross-env NODE_OPTIONS=--max_old_space_size=4096 refine build"
}
Additional Steps 1. Run Locally: Before deploying to Vercel, try running the build command locally to ensure it works:
npm run build

npm run build

2. Vercel Configuration: Ensure your vercel.json (if you have one) is correctly configured to use the build script. References For more information on configuring TypeScript in Refine, you can check the Refine documentation (https://refine.dev/docs). If you continue to face issues, you might find it helpful to look at the example projects provided by Refine, such as the starter-vite example (https://github.com/refinedev/refine/blob/master/examples/starter-vite/README.md) to compare configurations. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai6mo ago
<@918590213448675382> kapa.ai is still learning and improving, please let us know how it did by reacting below

Did you find this page helpful?