Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Bjorn Lu <[email protected]>
  • Loading branch information
ematipico and bluwy authored Aug 12, 2024
1 parent 9fa7f7c commit f038efd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .changeset/good-birds-clap.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'astro': patch
---

Fixes a case where omitting a semicolon in the `prerender` option could throw an error.
Fixes a case where omitting a semicolon and line ending with carriage return - CRLF - in the `prerender` option could throw an error.
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-scanner/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function scan(
.trim();
// For a given export, check the value of the first non-whitespace token.
// Basically extract the `true` from the statement `export const prerender = true`
const suffix = code.slice(endOfLocalName).trim().replace(/=/, '').trim().split(/[;?(\n|\r)]/)[0].trim();
const suffix = code.slice(endOfLocalName).trim().replace(/=/, '').trim().split(/[;\n\r]/)[0].trim();
if (prefix !== 'const' || !(isTruthy(suffix) || isFalsy(suffix))) {
throw new AstroError({
...AstroErrorData.InvalidPrerenderExport,
Expand Down

0 comments on commit f038efd

Please sign in to comment.