1 import { defineConfig } from 'astro/config'
2 import mdx from '@astrojs/mdx'
3 import sitemap from '@astrojs/sitemap'
4 import remarkMath from 'remark-math'
5 import remarkDirective from 'remark-directive'
6 import rehypeKatex from 'rehype-katex'
7 import remarkEmbeddedMedia from './src/plugins/remark-embedded-media.mjs'
8 import remarkReadingTime from './src/plugins/remark-reading-time.mjs'
9 import rehypeCleanup from './src/plugins/rehype-cleanup.mjs'
10 import rehypeImageProcessor from './src/plugins/rehype-image-processor.mjs'
11 import rehypeCopyCode from './src/plugins/rehype-copy-code.mjs'
12 import remarkTOC from './src/plugins/remark-toc.mjs'
13 import { SITE } from './src/config'
14 import path from 'path'
15 import tailwindcss from '@tailwindcss/vite'
16 import node from '@astrojs/node'
17
18 export default defineConfig({
19 site: SITE.website,
20 base: '/',
21
22 devToolbar: {
23 enabled: false
24 },
25
26 output: 'server',
27
28 build: {
29 inlineStylesheets: 'auto'
30 },
31
32 image: {
33 service: {
34 entrypoint: 'astro/assets/services/sharp'
35 }
36 },
37
38 markdown: {
39 shikiConfig: {
40 theme: 'css-variables',
41 wrap: false
42 },
43 remarkPlugins: [remarkMath, remarkDirective, remarkEmbeddedMedia, remarkReadingTime, remarkTOC],
44 rehypePlugins: [rehypeKatex, rehypeCleanup, rehypeImageProcessor, rehypeCopyCode]
45 },
46
47 integrations: [mdx(), sitemap()],
48
49 vite: {
50 resolve: {
51 alias: {
52 '@': path.resolve('./src')
53 }
54 },
55
56 build: {
57 rollupOptions: {
58 output: {
59 manualChunks: {
60 'vendor-katex': ['katex'],
61 'vendor-utils': ['reading-time', 'mdast-util-to-string']
62 }
63 }
64 }
65 },
66
67 optimizeDeps: {
68 include: ['katex', 'reading-time']
69 },
70
71 plugins: [tailwindcss()]
72 },
73
74 adapter: node({
75 mode: 'middleware'
76 })
77 })