Skip to content

Commit

Permalink
fix: log a warning if fallback page overwrites prerendered page (#11661)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Jan 18, 2024
1 parent 0bd1a4e commit 119971c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/thin-rules-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sveltejs/kit": patch
---

fix: log a warning if fallback page overwrites prerendered page
13 changes: 12 additions & 1 deletion packages/kit/src/core/adapt/builder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { existsSync, statSync, createReadStream, createWriteStream } from 'node:fs';
import colors from 'kleur';
import { createReadStream, createWriteStream, existsSync, statSync } from 'node:fs';
import { extname, resolve } from 'node:path';
import { pipeline } from 'node:stream';
import { promisify } from 'node:util';
Expand Down Expand Up @@ -153,6 +154,16 @@ export function create_builder({
env: { ...env.private, ...env.public }
});

if (existsSync(dest)) {
console.log(
colors
.bold()
.yellow(
`Overwriting ${dest} with fallback page. Consider using a different name for the fallback.`
)
);
}

write(dest, fallback);
},

Expand Down

0 comments on commit 119971c

Please sign in to comment.