Make Netlify adapter actually append redirects (#3079)
This commit is contained in:
parent
771127ea29
commit
9f248b0563
2 changed files with 9 additions and 5 deletions
5
.changeset/lemon-elephants-sell.md
Normal file
5
.changeset/lemon-elephants-sell.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/netlify': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Make Netlify adapter actually append redirects
|
|
@ -53,11 +53,10 @@ ${pattern} /.netlify/functions/${entryFile} 200`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs.existsSync(_redirects)) {
|
// Always use appendFile() because the redirects file could already exist,
|
||||||
await fs.promises.appendFile(_redirectsURL, _redirects, 'utf-8');
|
// e.g. due to a `/public/_redirects` file that got copied to the output dir.
|
||||||
} else {
|
// If the file does not exist yet, appendFile() automatically creates it.
|
||||||
await fs.promises.writeFile(_redirectsURL, _redirects, 'utf-8');
|
await fs.promises.appendFile(_redirectsURL, _redirects, 'utf-8');
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue