2023-11-08 23:03:32 +00:00
|
|
|
import adapter from '@sveltejs/adapter-cloudflare';
|
2023-11-01 23:36:58 +00:00
|
|
|
import { vitePreprocess } from '@sveltejs/kit/vite';
|
|
|
|
import preprocess from 'svelte-preprocess';
|
2023-11-08 23:03:32 +00:00
|
|
|
|
|
|
|
// import { mdsvexGlobalComponents } from './src/lib/utils/mdsvexGlobalComponents.js/index.js';
|
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';
|
|
|
|
/* Not using
|
|
|
|
// import { mdsvexGlobalComponents } from './src/lib/utils/mdsvex-global-components.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: [
|
2023-11-01 23:36:58 +00:00
|
|
|
preprocess({
|
|
|
|
postcss: true
|
|
|
|
}),
|
2023-11-16 03:29:08 +00:00
|
|
|
vitePreprocess(),
|
|
|
|
|
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.
|
|
|
|
|
2023-11-08 23:03:32 +00:00
|
|
|
adapter: adapter({}),
|
|
|
|
// sometimes problems with
|
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
|
|
|
},
|
|
|
|
// TODO: FIX Banning external malware scripts for security and privacy of users, threw errors,
|
|
|
|
// csp: {
|
|
|
|
// directives: {
|
|
|
|
// 'script-src': ['self']
|
|
|
|
// },
|
|
|
|
// reportOnly: {
|
|
|
|
// 'script-src': ['self']
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
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 &&
|
|
|
|
details.path.startsWith('/blog') &&
|
|
|
|
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;
|