Skip to content

Commit

Permalink
fix: rebase _routes.json for Cloudflare when config.base set (#6473)
Browse files Browse the repository at this point in the history
  • Loading branch information
RichiCoder1 authored Mar 13, 2023
1 parent 4e2abd8 commit 8dcc323
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/integrations/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ export default function createIntegration(args?: Options): AstroIntegration {
.map((file: string) => `/${file}`);

for (let page of pages) {
staticPathList.push(prependForwardSlash(page.pathname));
let pagePath = prependForwardSlash(page.pathname);
if (_config.base !== '/') {
const base = _config.base.endsWith('/') ? _config.base.substring(0, -1) : _config.base;
pagePath = `${base}${pagePath}`;
}
staticPathList.push(pagePath);
}

const redirectsExists = await fs.promises
Expand Down

0 comments on commit 8dcc323

Please sign in to comment.