diff --git a/packages/astro/src/core/build/plugins/plugin-middleware.ts b/packages/astro/src/core/build/plugins/plugin-middleware.ts index 47ff4b863cf3d..5981a37231a4c 100644 --- a/packages/astro/src/core/build/plugins/plugin-middleware.ts +++ b/packages/astro/src/core/build/plugins/plugin-middleware.ts @@ -25,7 +25,7 @@ export function vitePluginMiddleware( async resolveId(id) { if (id === MIDDLEWARE_MODULE_ID) { const middlewareId = await this.resolve( - `${opts.settings.config.srcDir.pathname}/${MIDDLEWARE_PATH_SEGMENT_NAME}` + `${decodeURI(opts.settings.config.srcDir.pathname)}${MIDDLEWARE_PATH_SEGMENT_NAME}` ); if (middlewareId) { resolvedMiddlewareId = middlewareId.id; @@ -58,6 +58,7 @@ export function vitePluginMiddleware( continue; } if (chunk.fileName === 'middleware.mjs') { + console.log(chunkName) const outputDirectory = getOutputDirectory(opts.settings.config); internals.middlewareEntryPoint = new URL(chunkName, outputDirectory); }