2023-08-30 05:02:51 -05:00
|
|
|
/* eslint-env node */
|
2023-03-17 15:08:08 -05:00
|
|
|
import { defineConfig } from "astro/config";
|
2023-08-26 08:37:02 -05:00
|
|
|
import lightningcss from "vite-plugin-lightningcss";
|
2023-03-17 15:08:08 -05:00
|
|
|
|
2023-03-17 20:43:57 -05:00
|
|
|
import cloudflare from "@astrojs/cloudflare";
|
2023-08-26 08:27:20 -05:00
|
|
|
import deno from "@astrojs/deno";
|
|
|
|
import netlify from "@astrojs/netlify";
|
2023-03-17 15:08:08 -05:00
|
|
|
import node from "@astrojs/node";
|
|
|
|
import vercel from "@astrojs/vercel/serverless";
|
|
|
|
|
2023-08-30 05:19:28 -05:00
|
|
|
let adapterConfig = {};
|
2023-08-26 08:27:20 -05:00
|
|
|
if (process.env.VERCEL) {
|
|
|
|
console.info("Using Vercel (serverless) adapter...");
|
2023-08-30 05:19:28 -05:00
|
|
|
adapterConfig = {
|
2023-08-26 08:27:20 -05:00
|
|
|
adapter: vercel(),
|
2023-08-30 06:32:01 -05:00
|
|
|
build: {
|
|
|
|
split: true,
|
|
|
|
},
|
2023-08-26 08:27:20 -05:00
|
|
|
};
|
|
|
|
} else if (process.env.CF_PAGES) {
|
|
|
|
console.info("Using Cloudflare adapter...");
|
2023-08-30 05:19:28 -05:00
|
|
|
adapterConfig = {
|
2023-08-26 08:27:20 -05:00
|
|
|
adapter: cloudflare(),
|
|
|
|
};
|
2023-03-17 15:08:08 -05:00
|
|
|
} else if (process.env.NETLIFY) {
|
2023-08-26 08:27:20 -05:00
|
|
|
console.info("Using Netlify (Functions) adapter...");
|
2023-08-30 05:19:28 -05:00
|
|
|
adapterConfig = {
|
2023-08-26 08:27:20 -05:00
|
|
|
adapter: netlify(),
|
|
|
|
};
|
|
|
|
} else if (process.argv.includes("--s2f-use-deno")) {
|
|
|
|
console.info("Using Deno adapter...");
|
2023-08-30 05:19:28 -05:00
|
|
|
adapterConfig = {
|
2023-08-26 08:27:20 -05:00
|
|
|
adapter: deno(),
|
|
|
|
};
|
2023-03-17 15:08:08 -05:00
|
|
|
} else {
|
2023-08-26 08:27:20 -05:00
|
|
|
console.info("Using Node.js adapter...");
|
|
|
|
console.info("Run with '--s2f-use-deno' flag to use Deno");
|
2023-08-30 05:19:28 -05:00
|
|
|
adapterConfig = {
|
2023-08-26 08:27:20 -05:00
|
|
|
adapter: node({
|
|
|
|
mode: "standalone",
|
|
|
|
}),
|
|
|
|
};
|
2023-03-17 15:08:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
site: "https://s2f.kytta.dev",
|
2023-08-30 05:19:28 -05:00
|
|
|
|
|
|
|
compressHTML: true,
|
|
|
|
|
|
|
|
output: "server",
|
|
|
|
...adapterConfig,
|
|
|
|
|
2023-08-26 08:37:02 -05:00
|
|
|
vite: {
|
|
|
|
plugins: [lightningcss()],
|
|
|
|
},
|
2023-03-17 15:08:08 -05:00
|
|
|
});
|