Skip to content

Commit

Permalink
fix(middleware): undo config's path to URL encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy committed Sep 21, 2023
1 parent 0119a27 commit cd2f448
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/astro/src/core/build/plugins/plugin-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit cd2f448

Please sign in to comment.