-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathastro.config.mjs
79 lines (77 loc) · 1.88 KB
/
astro.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { defineConfig } from "astro/config";
import astroI18next from "astro-i18next";
import aws from "astro-sst";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import solidJs from "@astrojs/solid-js";
import pagefind from "./integrations/pagefind";
import auth from "./integrations/auth";
import { loadEnv } from "vite";
import { LOCALES, DEFAULT_LOCALE } from "./src/config/i18nConfig";
const { IS_PUBLIC, PRE_BUILD, CUSTOM_DOMAIN } = loadEnv(
process.env.NODE_ENV,
process.cwd(),
""
);
const is_public = IS_PUBLIC === "true"
const is_pre_build = PRE_BUILD === "true"
// https://astro.build/config
export default defineConfig({
...(is_public
? {
output: "static",
adapter: aws(),
integrations: [
sitemap(),
pagefind({
is_pre_build: is_pre_build,
is_public: is_public,
}),
tailwind({
applyBaseStyles: false,
}),
solidJs(),
astroI18next(),
],
}
: {
output: PRE_BUILD ? "hybrid" : "server",
adapter: aws({
serverRoutes: ["/api/*"],
}),
integrations: [
sitemap(),
pagefind({
is_pre_build: is_pre_build,
is_public: is_public,
}),
tailwind({
applyBaseStyles: false,
}),
solidJs(),
astroI18next(),
auth({
injectEndpoints: true,
}),
],
}),
site: `https://${CUSTOM_DOMAIN}`,
cacheDir: "./cache",
compressHTML: true,
build: {
rollupOptions: {
external: ["/pagefind/pagefind.js"],
},
},
vite: {
optimizeDeps: { exclude: ['auth:config'] },
},
i18n: {
defaultLocale: DEFAULT_LOCALE,
locales: LOCALES,
routing: {
prefixDefaultLocale: true,
redirectToDefaultLocale: true
}
}
});