-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvelte.config.js
More file actions
45 lines (41 loc) · 1.17 KB
/
svelte.config.js
File metadata and controls
45 lines (41 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
// Keep main-site base separate from nested tool BASE_PATH values.
const siteBasePath = process.env.SITE_BASE_PATH || '';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://svelte.dev/docs/kit/integrations
// for more information about preprocessors
preprocess: vitePreprocess(),
kit: {
adapter: adapter({
// Use explicit defaults and keep SPA fallback for GitHub Pages deep links
pages: 'build',
assets: 'build',
fallback: '200.html',
precompress: false,
strict: true
}),
paths: {
base: siteBasePath
},
prerender: {
// Avoid build failures if the crawler hits asset URLs (e.g., favicons)
handleHttpError: ({ path, status }) => {
if (
path.startsWith('/favicon/') ||
path.endsWith('.png') ||
path.endsWith('.svg') ||
path.endsWith('.ico') ||
path.endsWith('.webmanifest') ||
status === 404
) {
return;
}
// Re-throw other errors to surface real issues
throw new Error(`Prerender error at ${path} (status ${status})`);
}
}
}
};
export default config;