Skip to content

Commit

Permalink
[docs] prerendering adjustments (#6577)
Browse files Browse the repository at this point in the history
- add the file ending, which should make it more clear where to put things (even if some use .ts, they'll get the idea)
- remove obsolete config

Closes #6538
  • Loading branch information
dummdidumm authored Sep 5, 2022
1 parent a36cdd9 commit 3579bad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-wombats-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-static': patch
---

[docs] more specific error message when prerendering fails
2 changes: 1 addition & 1 deletion documentation/docs/11-page-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ It's likely that at least some routes of your app can be represented as a simple
export const prerender = true;
```

Alternatively, you can set `export const prerender = true` in your root `+layout` and prerender everything except pages that are explicitly marked as _not_ prerenderable:
Alternatively, you can set `export const prerender = true` in your root `+layout.js` or `+layout.server.js` and prerender everything except pages that are explicitly marked as _not_ prerenderable:

```js
/// file: +page.js/+page.server.js/+server.js
Expand Down
2 changes: 0 additions & 2 deletions documentation/docs/14-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const config = {
prerender: {
concurrency: 1,
crawl: true,
default: false,
enabled: true,
entries: ['*'],
onError: 'fail',
Expand Down Expand Up @@ -260,7 +259,6 @@ See [Prerendering](/docs/page-options#prerender). An object containing zero or m

- `concurrency` — how many pages can be prerendered simultaneously. JS is single-threaded, but in cases where prerendering performance is network-bound (for example loading content from a remote CMS) this can speed things up by processing other tasks while waiting on the network response
- `crawl` — determines whether SvelteKit should find pages to prerender by following links from the seed page(s)
- `default` — set to `true` to prerender encountered pages not containing `export const prerender = false`
- `enabled` — set to `false` to disable prerendering altogether
- `entries` — an array of pages to prerender, or start crawling from (if `crawl: true`). The `*` string includes all non-dynamic routes (i.e. pages with no `[parameters]` )
- `onError`
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function (options) {
if (dynamic_routes.length > 0) {
const prefix = path.relative('.', builder.config.kit.files.routes);
builder.log.error(
`@sveltejs/adapter-static: all routes must be fully prerenderable (unless using the 'fallback' option — see https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode). Try adding \`export const prerender = true\` to your root layout — see https://kit.svelte.dev/docs/page-options#prerender for more details`
`@sveltejs/adapter-static: all routes must be fully prerenderable (unless using the 'fallback' option — see https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode). Try adding \`export const prerender = true\` to your root layout.js — see https://kit.svelte.dev/docs/page-options#prerender for more details`
);
builder.log.error(
dynamic_routes.map((id) => ` - ${path.posix.join(prefix, id)}`).join('\n')
Expand Down

0 comments on commit 3579bad

Please sign in to comment.