Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

Vite cannot find an entry point to scan in Docker or CI

ErrorCould not auto-determine entry point from rollupOptions or html files

Short answer

Vite scans your .html files, or the input you configure, to find what to pre-bundle. This error means it found none. In Docker the usual reason is that index.html never reached the image, or the command runs in the wrong folder. Check the file is there, then set the input or optimizeDeps.entries if your page is not at the root.

  • Applies to Vite 7, Vite 8
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run the same command in the same folder the build uses and list what is there. Inside Docker, do it in the built image.

    docker run --rm my-app ls -la /app
  2. 2Match what you see, then jump to its fix

    1. 1ls shows package.json and node_modules but no index.htmlindex.html is not in the folder Vite runs fromFix
    2. 2index.html exists on your machine but not in the image.dockerignore removes the entry file from the build contextFix
    3. 3index.html is in a subfolder, or you build a library with no pageThe page lives elsewhere and no entry is configuredFix

What does the error look like?

  • Could not auto-determine entry point from rollupOptions or html files

Cause 1 of 3

index.html is not in the folder Vite runs from

1Check

By default Vite builds from index.html in the project root and crawls .html files for dependencies. A COPY step that skips it, a wrong WORKDIR, or a build run one level up leaves nothing to crawl.

grep -n "COPY\|WORKDIR" Dockerfile
ls index.html

2Fix

Copy the project files into the image and run the command in the folder that holds index.html.

WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

3Verify

Rebuild the image; the error is gone.

docker build -t my-app .

Confirmed by vite.dev

Did this fix it?

Cause 2 of 3

.dockerignore removes the entry file from the build context

1Check

Files matching .dockerignore are removed from the build context before it is sent, so COPY cannot add them to the image.

cat .dockerignore

2Fix

Delete the pattern that matches index.html or the folder holding it, or add a negation for it.

# .dockerignore
node_modules
dist
!index.html

3Verify

Rebuild without cache and list the folder.

docker build --no-cache -t my-app .
docker run --rm my-app ls /app/index.html

Confirmed by docs.docker.com

Did this fix it?

Cause 3 of 3

The page lives elsewhere and no entry is configured

1Check

Vite crawls html files, but when you set input it crawls that instead. If you set optimizeDeps.entries yourself, it replaces the automatic search entirely.

grep -n -B2 -A4 "input\|entries" vite.config.*

2Fix

Point entries at the real files, relative to the project root. For a multi-page app, list each html file as an entry.

// vite.config.js
import { defineConfig } from 'vite'

export default defineConfig({
  optimizeDeps: {
    entries: ['src/pages/**/*.html'],
  },
})

3Verify

Run the dev server or the build again.

npx vite build

Confirmed by vite.dev

Did this fix it?

How do I stop it coming back?

  • Run npx vite build in a clean clone in CI, so a file missing from git or .dockerignore shows up before deploy.
  • Keep one WORKDIR and copy to it explicitly.
  • After setting optimizeDeps.entries, remember it overrides the automatic search.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.