diff --git a/svelte.config.js b/svelte.config.js index 7785acd0..b20ad413 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,10 +1,27 @@ import staticAdapter from '@sveltejs/adapter-static'; import vercelAdapter from '@sveltejs/adapter-vercel'; +import nodeAdapter from "@sveltejs/adapter-node"; + import { vitePreprocess } from '@sveltejs/kit/vite'; /** @type {import('@sveltejs/kit').Config} */ const BASE_PATH = process.env.BASE_PATH || ''; const GITHUB_PAGES = process.env.GITHUB_ACTIONS === 'true'; +const CSUNIBO_DEPLOY = process.env.CSUNIBO_DEPLOY === 'true'; + +/** + * + * @returns {import('@sveltejs/kit').Adapter} + */ +function chooseAdapter() { + if (GITHUB_PAGES) { + return staticAdapter({ fallback: '404.html' }); + } else if (CSUNIBO_DEPLOY) { + return nodeAdapter(); + } else { + return vercelAdapter(); + } +} const config = { // Consult https://kit.svelte.dev/docs/integrations#preprocessors @@ -15,11 +32,7 @@ const config = { // 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. - adapter: GITHUB_PAGES - ? staticAdapter({ - fallback: '404.html' - }) - : vercelAdapter(), + adapter: chooseAdapter(), paths: { base: BASE_PATH }