summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/sweet-cherries-tickle.md5
-rw-r--r--packages/integrations/cloudflare/src/index.ts7
2 files changed, 11 insertions, 1 deletions
diff --git a/.changeset/sweet-cherries-tickle.md b/.changeset/sweet-cherries-tickle.md
new file mode 100644
index 000000000..70e6db104
--- /dev/null
+++ b/.changeset/sweet-cherries-tickle.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/cloudflare': patch
+---
+
+fix automatic routes generation not respecting config.base
diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts
index a72e0db46..f87b701e9 100644
--- a/packages/integrations/cloudflare/src/index.ts
+++ b/packages/integrations/cloudflare/src/index.ts
@@ -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