diff --git a/.changeset/quiet-crews-tickle.md b/.changeset/quiet-crews-tickle.md new file mode 100644 index 0000000..0167f2e --- /dev/null +++ b/.changeset/quiet-crews-tickle.md @@ -0,0 +1,5 @@ +--- +"vite-plugin-static-copy": patch +--- + +don't crash when the requested path is mapped to a directory diff --git a/src/middleware.ts b/src/middleware.ts index 2bd5366..599c133 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -262,7 +262,7 @@ export function serveStaticCopyMiddleware( try { const data = viaLocal(root, publicDir, fileMap, pathname) - if (!data) { + if (!data || data.stats.isDirectory()) { return404(res, next) return }