forked from otoyo/astro-notion-blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
55 lines (52 loc) · 1.69 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
import { defineConfig } from 'astro/config'
import { CUSTOM_DOMAIN, BASE_PATH } from './src/server-constants'
import CoverImageDownloader from './src/integrations/cover-image-downloader'
import CustomIconDownloader from './src/integrations/custom-icon-downloader'
import FeaturedImageDownloader from './src/integrations/featured-image-downloader'
import PublicNotionCopier from './src/integrations/public-notion-copier'
import tailwind from '@astrojs/tailwind'
import react from '@astrojs/react'
import yaml from '@rollup/plugin-yaml'
const getSite = function () {
if (CUSTOM_DOMAIN) {
return new URL(BASE_PATH, `https://${CUSTOM_DOMAIN}`).toString()
}
if (process.env.VERCEL && process.env.VERCEL_URL) {
return new URL(BASE_PATH, `https://${process.env.VERCEL_URL}`).toString()
}
if (process.env.CF_PAGES) {
if (process.env.CF_PAGES_BRANCH !== 'main') {
return new URL(BASE_PATH, process.env.CF_PAGES_URL).toString()
}
return new URL(
BASE_PATH,
`https://${new URL(process.env.CF_PAGES_URL).host
.split('.')
.slice(1)
.join('.')}`
).toString()
}
return new URL(BASE_PATH, 'http://localhost:4321').toString();
};
// https://astro.build/config
export default defineConfig({
site: getSite(),
base: BASE_PATH,
integrations: [
CoverImageDownloader(),
CustomIconDownloader(),
FeaturedImageDownloader(),
PublicNotionCopier(),
tailwind(),
// Example: Disable injecting a basic `base.css` import on every page.
// Useful if you need to define and/or import your own custom `base.css`.
// maka harus di comment
// {
// applyBaseStyles: false,
// }
react(),
],
vite: {
plugins: [yaml()],
},
})