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)) {
|
||||
await fs.promises.appendFile(_redirectsURL, _redirects, 'utf-8');
|
||||
} else {
|
||||
await fs.promises.writeFile(_redirectsURL, _redirects, 'utf-8');
|
||||
}
|
||||
// Always use appendFile() because the redirects file could already exist,
|
||||
// e.g. due to a `/public/_redirects` file that got copied to the output dir.
|
||||
// If the file does not exist yet, appendFile() automatically creates it.
|
||||
await fs.promises.appendFile(_redirectsURL, _redirects, 'utf-8');
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue