What this thread does
TypeError: Cannot read properties of undefined (reading 'call') — check dev loading for a template-only handler's missed lazy import. Error: EISDIR: illegal operation on a directory, read — check vite:build-html for a query-only HTML link.
The dev case crashes after optimizer discovery reloads a loading page and mixes runtime chunks; the build case resolves ?md to the HTML directory and reads it as a file.
First actions — Untested experiment: name the missed dependency in optimizeDeps.include and restart with npx vite --force. For EISDIR, inspect <link rel="alternate" type="text/markdown" href="?md"> and run npx vite build; Untested experiment: temporarily remove optional export metadata and rebuild, preserving required link behavior.
Evidence: two reporter reproductions distinguish dev and build causes; PR #23881 proposes a scanner fix and remains open (checked 2026-11-15). Prebundling and link removal remain untested; no released fix or general cause for every matching error is established.
Not for: Vite deployed missing chunks or choosing Vite 8, esbuild, Turbopack, webpack or tsdown as a bundler.
What changed
- The official migration guide explains that Vite 8 (checked 2026-10-28) uses Rolldown for dependency optimization instead of esbuild.
- janosh's #23880, reported 2026-10-23 (checked 2026-10-28), shows template-only handlers hiding lazy imports from that scanner. It reproduces on Vite 8.3.5 (checked 2026-10-28).
- lumatic2's #23807, reported 2026-10-17 (checked 2026-10-28), shows query-only links breaking HTML builds on Vite 8.3.4 (checked 2026-10-28). The report also reproduces on an earlier major; this is not exclusively a new-major regression.
How to migrate
1. Identify dev-server loading versus vite build before changing configuration. Record npm ls vite. 2. Untested experiment: for the lazy-import case, use documented optimizeDeps.include (checked 2026-10-28) to name the dependency the scanner missed. The issue's small reproduction uses nanoid; substitute your actual dependency and merge into your existing config.
export default {
optimizeDeps: {
include: ['nanoid'],
},
}
Restart with npx vite --force. The configuration option is documented; recovery from this crash remains unverified. Exercise the handler that loads the lazy module. PR #23881 proposes fixing the scan itself; it remains open (checked 2026-10-28).
3. For EISDIR, inspect the affected HTML for query-only links, then reproduce the failure:
npx vite build
The reported trigger is <link rel="alternate" type="text/markdown" href="?md">. Untested experiment: if it is optional export metadata, temporarily remove the link and rerun npx vite build to isolate the trigger. If consumers need it, preserve its intended behavior and seek the upstream HTML-plugin fix; do not replace it with a made-up asset path. No confirmed fixed release is prescribed by the report.
What breaks
Diagnostic: TypeError: Cannot read properties of undefined (reading 'call')
In the SvelteKit report, an import inside a function used only by the template is missed at startup. Discovering its dependency later triggers an optimizer reload while the page is loading, mixing runtime chunks. The report and proposed PR connect this error to that sequence; the message alone is not proof of the cause.
Diagnostic: Error: EISDIR: illegal operation on a directory, read
For the reported HTML link, vite:build-html resolves ?md to the HTML directory and tries to read it as a file. Do not treat this as a request to change directory permissions. The dependency optimizer setting above is dev-only and cannot repair this HTML build path.
What to test
Start with a fresh optimizer run, then open the affected route and invoke template-only handlers. Check whether the required dependency is prebundled before the interaction and whether the reload crash disappears. Separately build the exported HTML and check the alternate Markdown link's intended behavior if you retain or restore it.
Pitfalls
Do not clear caches repeatedly while leaving a reproducible scanner miss. Do not infer a fixed release from a linked PR. Do not downgrade a major as a universal EISDIR fix; the report spans majors.
Before making changes
Read #23880, #23807, the migration guide and optimizer options. Classify dev versus build failure, reproduce the exact trigger, and evaluate the smallest change as an untested experiment. Preserve framework plugins and HTML semantics. Do not guess that a release contains either fix.
Limits
Prebundling and link removal remain untested experiments. Evidence is two distinct reporter reproductions plus a proposed scanner fix; no general cause for every matching TypeError or EISDIR is established. Confirm a release actually contains the relevant fix before removing a workaround (checked 2026-10-28).
Started from a post by @janosh, packaged by the editor. Original post