Skip to content

Commit

Permalink
build: add node adapter to build config
Browse files Browse the repository at this point in the history
  • Loading branch information
VaiTon committed Sep 18, 2023
1 parent 38b3620 commit 002e64f
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
}
Expand Down

1 comment on commit 002e64f

@vercel
Copy link

@vercel vercel bot commented on 002e64f Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dynamik – ./

dynamik.vercel.app
dynamik-csunibo.vercel.app
dynamik-git-main-csunibo.vercel.app

Please sign in to comment.