summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/netlify')
-rw-r--r--packages/integrations/netlify/src/shared.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/packages/integrations/netlify/src/shared.ts b/packages/integrations/netlify/src/shared.ts
index c0d8a4ce5..2c648984a 100644
--- a/packages/integrations/netlify/src/shared.ts
+++ b/packages/integrations/netlify/src/shared.ts
@@ -14,18 +14,28 @@ export async function createRedirects(
let _redirects = '';
for (const route of routes) {
if (route.pathname) {
- _redirects += `
+ if (route.distURL) {
+ _redirects += `
+ ${route.pathname} /${route.distURL.toString().replace(dir.toString(), '')} 200`;
+ } else {
+ _redirects += `
${route.pathname} /.netlify/${kind}/${entryFile} 200`;
- if (route.route === '/404') {
- _redirects += `
+ if (route.route === '/404') {
+ _redirects += `
/* /.netlify/${kind}/${entryFile} 404`;
+ }
}
} else {
const pattern =
'/' + route.segments.map(([part]) => (part.dynamic ? '*' : part.content)).join('/');
- _redirects += `
+ if (route.distURL) {
+ _redirects += `
+ ${pattern} /${route.distURL.toString().replace(dir.toString(), '')} 200`;
+ } else {
+ _redirects += `
${pattern} /.netlify/${kind}/${entryFile} 200`;
+ }
}
}