2024-04-04 00:39:54 +00:00
|
|
|
import adapter from '@sveltejs/adapter-node';
|
2023-11-01 23:36:58 +00:00
|
|
|
import preprocess from 'svelte-preprocess';
|
2023-11-08 23:03:32 +00:00
|
|
|
|
2024-04-04 00:39:54 +00:00
|
|
|
// config extensions
|
2023-11-01 23:36:58 +00:00
|
|
|
import { mdsvex } from 'mdsvex';
|
2023-11-08 23:03:32 +00:00
|
|
|
import mdsvexConfig from './mdsvex.config.js';
|
2023-11-01 23:36:58 +00:00
|
|
|
|
|
|
|
/** @type {import('@sveltejs/kit').Config} */
|
|
|
|
const config = {
|
2023-11-08 23:03:32 +00:00
|
|
|
extensions: ['.svelte', ...(mdsvexConfig.extensions || [])],
|
2023-11-01 23:36:58 +00:00
|
|
|
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
|
|
|
// for more information about preprocessors
|
2023-11-08 23:03:32 +00:00
|
|
|
preprocess: [
|
2024-04-04 00:39:54 +00:00
|
|
|
preprocess({ postcss: true }),
|
2023-11-16 03:29:08 +00:00
|
|
|
|
2023-11-08 23:03:32 +00:00
|
|
|
// No neeed rn unless using mdsvex highlighter with svelte components
|
|
|
|
//mdsvexGlobalComponents({
|
|
|
|
// dir: `$lib/components/blog`,
|
|
|
|
// list: ['CodeFence.svelte'],
|
|
|
|
// extensions: ['.md']
|
|
|
|
// }),
|
|
|
|
mdsvex(mdsvexConfig)
|
2023-11-01 23:36:58 +00:00
|
|
|
],
|
2023-11-08 23:03:32 +00:00
|
|
|
|
2023-11-01 23:36:58 +00:00
|
|
|
vitePlugin: {
|
2023-11-08 23:03:32 +00:00
|
|
|
inspector: true
|
2023-11-01 23:36:58 +00:00
|
|
|
},
|
|
|
|
kit: {
|
|
|
|
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
|
|
|
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
|
|
|
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
|
|
|
|
2024-04-04 00:39:54 +00:00
|
|
|
adapter: adapter({
|
|
|
|
out: 'build',
|
|
|
|
precompress: false
|
|
|
|
}),
|
|
|
|
|
|
|
|
// Aliases need tsconfig explicit inclusion
|
2023-11-01 23:36:58 +00:00
|
|
|
alias: {
|
2024-02-12 18:56:47 +00:00
|
|
|
$lib: './src/lib',
|
|
|
|
$root: './',
|
|
|
|
$src: './src',
|
|
|
|
$routes: './src/routes',
|
|
|
|
$content: './src/content'
|
2023-11-08 23:03:32 +00:00
|
|
|
},
|
|
|
|
csrf: {
|
|
|
|
checkOrigin: process.env.NODE_ENV === 'development' ? false : true
|
2023-11-01 23:36:58 +00:00
|
|
|
},
|
|
|
|
prerender: {
|
2023-11-08 23:03:32 +00:00
|
|
|
crawl: true,
|
|
|
|
handleMissingId: 'warn',
|
|
|
|
handleHttpError: (details) => {
|
|
|
|
// Handle blog trying to prerender relative links that it can't
|
|
|
|
if (
|
|
|
|
details.status == 404 &&
|
2024-04-04 00:39:54 +00:00
|
|
|
details.path.startsWith('/blog' && '/projects') &&
|
2023-11-08 23:03:32 +00:00
|
|
|
details.referenceType == 'linked'
|
|
|
|
) {
|
|
|
|
console.warn(`PRERENDER ignored route ${details.path}`);
|
|
|
|
return;
|
|
|
|
}
|
2023-11-01 23:36:58 +00:00
|
|
|
|
2023-11-08 23:03:32 +00:00
|
|
|
throw new Error(`${details.status} ${details.path} from ${details.referrer}`);
|
|
|
|
}
|
|
|
|
}
|
2023-11-01 23:36:58 +00:00
|
|
|
}
|
|
|
|
};
|
2023-11-08 23:03:32 +00:00
|
|
|
|
|
|
|
export default config;
|