/ astro.config.mjs
astro.config.mjs
 1  import { defineConfig, envField, passthroughImageService } from "astro/config";
 2  import path from "node:path";
 3  import svelte from "@astrojs/svelte";
 4  import mdx from "@astrojs/mdx";
 5  import Icons from "unplugin-icons/vite";
 6  import tailwindcss from "@tailwindcss/vite";
 7  import cloudflare from "@astrojs/cloudflare";
 8  import remarkGfm from "remark-gfm";
 9  import remarkWikiLink from "@flowershow/remark-wiki-link";
10  
11  export default defineConfig({
12  	experimental: {
13  		liveContentCollections: true,
14  	},
15  	output: "server",
16  	prefetch: true,
17  	adapter: cloudflare({
18  		imageService: "passthrough",
19  	}),
20  	image: {
21  		service: passthroughImageService(),
22  	},
23  	integrations: [
24  		svelte(),
25  		mdx({
26  			remarkPlugins: [
27  				remarkGfm,
28  				[
29  					remarkWikiLink,
30  					{
31  						wikiLinkClassName: "wiki-link",
32  						pageResolver: (name) => [name.toLowerCase().replace(/\s+/g, "-")],
33  						hrefTemplate: (slug) => `/notes/${slug}`,
34  					},
35  				],
36  			],
37  		}),
38  	],
39  	site: "https://elianiva.my.id",
40  	markdown: {
41  		shikiConfig: {
42  			theme: "rose-pine-dawn",
43  		},
44  		remarkPlugins: [
45  			remarkGfm,
46  			[
47  				remarkWikiLink,
48  				{
49  					wikiLinkClassName: "wiki-link",
50  					pageResolver: (name) => [name.toLowerCase().replace(/\s+/g, "-")],
51  					hrefTemplate: (slug) => `/notes/${slug}`,
52  				},
53  			],
54  		],
55  	},
56  	vite: {
57  		plugins: [Icons({ compiler: "svelte" }), tailwindcss()],
58  		resolve: {
59  			alias: {
60  				"~/*": path.resolve("src"),
61  			},
62  		},
63  		ssr: {
64  			external: ["svgo"],
65  		},
66  	},
67  	env: {
68  		schema: {
69  			GH_TOKEN: envField.string({
70  				context: "server",
71  				access: "secret",
72  			}),
73  		},
74  	},
75  });