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
16 import tailwindcss from '@tailwindcss/vite';
17
18 export default defineConfig({
19 site: SITE.website,
20 i18n: {
21 defaultLocale: 'id',
22 locales: ['id', 'en'],
23 routing: {
24 prefixDefaultLocale: false
25 }
26 },
27 devToolbar: {
28 enabled: false
29 },
30 output: 'static',
31 build: {
32 inlineStylesheets: 'auto'
33 },
34 image: {
35 service: {
36 entrypoint: 'astro/assets/services/sharp'
37 }
38 },
39 markdown: {
40 shikiConfig: {
41 theme: 'css-variables',
42 wrap: false
43 },
44 remarkPlugins: [remarkMath, remarkDirective, remarkEmbeddedMedia, remarkReadingTime, remarkTOC],
45 rehypePlugins: [rehypeKatex, rehypeCleanup, rehypeImageProcessor, rehypeCopyCode]
46 },
47 integrations: [mdx(), sitemap()],
48 vite: {
49 resolve: {
50 alias: {
51 '@': path.resolve('./src')
52 }
53 },
54
55 build: {
56 rollupOptions: {
57 output: {
58 manualChunks: {
59 'vendor-katex': ['katex'],
60 'vendor-utils': ['reading-time', 'mdast-util-to-string']
61 }
62 }
63 }
64 },
65
66 optimizeDeps: {
67 include: ['katex', 'reading-time']
68 },
69
70 plugins: [tailwindcss()]
71 }
72 })