Vite React TS, cannot find 'dist' after build

I’ve been trying to build my project, running Typescript React on Vite Framework. The build runs find but it will always fail with Error: No Output Directory named "dist" found after the Build completed. You can configure the Output Directory in your Project Settings.

I use the build script as such "build": "tsc -b && vite build && ls dist", and got the log

computing gzip size...
dist/index.html                     0.46 kB │ gzip:   0.30 kB
dist/assets/index-Cz0sA0Lr.css      1.91 kB │ gzip:   0.85 kB
dist/assets/index-CCYWY1BZ.js   1,193.63 kB │ gzip: 343.88 kB
(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 11.72s
assets
camera.glb
droid.glb
index.html
laptop.gltf
Error: No Output Directory named "dist" found after the Build completed. You can configure the Output Directory in your Project Settings.

Here it declared that dist/ has been created with the output, and the ls output confirmed that. Still the deployment failed attempting to find ‘dist’

This is my first time trying Vercel, is there anything I should be aware of when this happen?

Deployment URL or Custom Domain: not deployed
Environment (local, preview, production):prod (local and preview works great)
Project Framework: Vite
Build Settings:
  Framework Preset:
  Build Command (if not default):npm run build
  Output Directory (if not default):dist
  Install Command (if not default):
Node/Runtime Version:
Package Manager:
Relevant Packages:

Where are you executing build script? Is the build script executed in the project root or outside the root directory of the project?

Do you have a barebones project repository we could use to try and replicate what you’re seeing?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.