esbuild "Could not resolve" import in CI
esbuild walked the import graph and could not locate the named module. The path does not point to a real file, the package is not installed, or the import case does not match the file on a case-sensitive runner.
What this error means
The build fails with "[ERROR] Could not resolve 'X'" and a code frame pointing at the import line.
esbuild
> src/index.ts:1:18: ERROR: Could not resolve "./utils/format"
1 | import { fmt } from "./utils/format";
| ~~~~~~~~~~~~~~~~~
1 errorCommon causes
A missing dependency or wrong relative path
The package was never installed in CI, or the relative path does not point to an existing file.
Case mismatch on a case-sensitive filesystem
Linux runners distinguish case, so ./Format will not resolve a file named format.ts.
How to fix it
Correct the path or install the dependency
- Confirm the imported file or package exists with the exact name and case.
- Install missing packages or fix the relative path.
- Re-run the build to confirm esbuild resolves it.
Terminal
npm ci
npx esbuild src/index.ts --bundle --outfile=out.jsAdd resolve extensions or node paths if needed
If imports omit extensions or rely on extra roots, configure esbuild so it can find them.
Terminal
npx esbuild src/index.ts --bundle \
--resolve-extensions=.ts,.js,.jsonHow to prevent it
- Match import paths to real file names and case.
- Commit a lockfile so CI installs every imported package.
- Keep resolve extensions configured for your file types.
Related guides
esbuild "Transform failed with N errors" in CIFix esbuild "Transform failed with N error(s)" in CI - esbuild could not parse or transform a file because of…
esbuild "No loader is configured for ... files" in CIFix esbuild "No loader is configured for '.X' files" in CI - esbuild reached a file extension it has no built…
Vite "Failed to resolve import" during build in CIFix Vite "Failed to resolve import 'X' from 'Y'. Does the file exist?" in CI - an import path does not resolv…