its-personal/svelte.config.js

55 lines
1.3 KiB
JavaScript
Raw Normal View History

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';
2024-04-04 00:39:54 +00:00
// config extensions
2023-11-01 23:36:58 +00:00
import { mdsvex } from 'mdsvex';
import mdsvexConfig from './mdsvex.config.js';
2023-11-01 23:36:58 +00:00
/** @type {import('@sveltejs/kit').Config} */
const config = {
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
2024-04-12 17:09:07 +00:00
preprocess: [preprocess({ postcss: true }), mdsvex(mdsvexConfig)],
2023-11-01 23:36:58 +00:00
vitePlugin: {
inspector: true
2023-11-01 23:36:58 +00:00
},
kit: {
2024-04-04 00:39:54 +00:00
adapter: adapter({
out: 'build',
precompress: false
}),
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'
},
csrf: {
checkOrigin: process.env.NODE_ENV === 'development' ? false : true
2023-11-01 23:36:58 +00:00
},
prerender: {
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') &&
details.referenceType == 'linked'
) {
console.warn(`PRERENDER ignored route ${details.path}`);
return;
}
2023-11-01 23:36:58 +00:00
throw new Error(`${details.status} ${details.path} from ${details.referrer}`);
}
}
2023-11-01 23:36:58 +00:00
}
};
export default config;