-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathminista.config.ts
More file actions
99 lines (96 loc) · 2.39 KB
/
Copy pathminista.config.ts
File metadata and controls
99 lines (96 loc) · 2.39 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import {
defineConfig,
pluginSsg,
pluginMdx,
pluginBundle,
pluginEntry,
pluginSvg,
pluginIsland,
pluginSearch,
} from "minista"
import react from "@vitejs/plugin-react"
import remarkGfm from "remark-gfm"
import remarkToc from "remark-toc"
import rehypeSlug from "rehype-slug"
import rehypeAutolinkHeadings from "rehype-autolink-headings"
import rehypePrettyCode from "rehype-pretty-code"
import { pluginSeo } from "./minista.local.js"
const remarkTocOptions = {
maxDepth: 3,
}
const rehypePrettyCodeOptions = {
grid: false,
theme: {
light: "github-light",
dark: "dracula-soft",
},
keepBackground: false,
keepFigure: false,
}
const preactAlias = {
react: "preact/compat",
"react-dom": "preact/compat",
}
export default defineConfig(({ command, isSsrBuild }) => {
const isDev = command === "serve"
const isSsr = command === "build" && isSsrBuild
const isBuild = command === "build" && !isSsrBuild
return {
plugins: [
pluginSsg(),
pluginMdx({
remarkPlugins: [remarkGfm, [remarkToc, remarkTocOptions]],
rehypePlugins: [
rehypeSlug,
rehypeAutolinkHeadings,
[rehypePrettyCode, rehypePrettyCodeOptions],
],
}),
pluginBundle(),
pluginEntry(),
pluginSvg(),
pluginIsland(),
pluginSearch({
src: ["docs/**/*.html"],
ignoreSelectors: [
"h1",
"#table-of-contents",
"#table-of-contents + ul",
"[data-rehype-pretty-code-title]",
"[data-stage]",
],
trimTitle: " - minista",
}),
pluginSeo({
src: ["docs/**/*.html"],
targetSelector: "[data-search]",
ignoreSelectors: [
"h1",
"#table-of-contents",
"#table-of-contents + ul",
"[data-rehype-pretty-code-title]",
"[data-stage]",
],
}),
react(),
],
build: {
assetsInlineLimit: 0,
rollupOptions: {
output: {
codeSplitting: {
groups: [
//{ name: "vendor", test: /\/node_modules\/(?!\.)/ },
//{ name: "react", test: /\/react(?:-dom)\// },
//{ name: "preact", test: /\/preact\// },
//{ name: "minista", test: /\/minista\/src|react-icons\// },
],
},
},
},
},
resolve: {
alias: isBuild ? preactAlias : undefined,
},
}
})