Resolving omitted generated files in the Vercel output directory

I’m a little baffled as I’ve used this setup before, yet it’s completely failing right now. My repo looks something like:

/public/index.html
src/..
.vercelignore
package.json

So I have a static index.html in the /public directory, and generate JS files in /public/js.

My .vercelignore looks like:

!public/js/**.js

The build logs indicate the build completed successfully, and I even through a find public at the end to reassure myself the files exist.

I would expect that any files generated in /public/js will be part of the static deployment, and listed under the resources tab for “static assets”—or at least the “output” subtab under “Source.”

None of the generated files are there, only index.html.

Not sure if it’s relevant, but I also have files in an /api directory. Again, the file that is committed to the repo is picked up as a function, but the function fails because it cannot import the generated file it references. I’ve used the same strategy of a committed js file importing a generated js file in a different Vercel project that is working just fine.

I’m quite stumped at this point as to what could be going wrong! The build settings are all the defaults, and the web UI correctly indicates this as an “Other” framework. Thanks in advance for your help!

Looking at your setup, I’m pretty sure Vercel is just tripping over your build output or that .vercelignore file.

A few quick things to check:

  • The Output: Is your build command actually dumping files where Vercel expects them (usually /public)?
  • The Ignore File: That !public/js/**.js pattern can be finicky. Try being super explicit with !public/js/**/*.js or just whitelist the whole directory.
  • Timing: Make sure those files exist before the build finishes. Vercel won’t grab anything created after the fact.

If you want to see what’s actually happening, toss ls -la public/js/ at the end of your build script. If the API can’t find the files, they definitely aren’t making it into the final bundle.

1 Like

Hey there, @dhleong! Just checking in on your issue with the generated files in the Vercel output directory. Have you found a solution, or do you still need help?