-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
64 lines (60 loc) · 1.93 KB
/
vite.config.ts
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
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import fs from 'fs'
import path from 'path'
import { env } from 'process'
import Pages from 'vite-plugin-pages'
import svgr from 'vite-plugin-svgr'
import mdx from "@mdx-js/rollup"
import remarkFrontmatter from 'remark-frontmatter' // YAML and such.
import remarkGfm from 'remark-gfm' // Tables, footnotes, strikethrough, task lists, literal URLs.
import remarkPrism from 'remark-prism'
import remarkParse from "remark-parse"
import rehypeStringify from 'rehype-stringify'
import remarkDirective from 'remark-directive'
import rehypeRaw from 'rehype-raw'
import { remarkContainers, remarkFencedCode } from './vite.config.markdown'
// @ts-ignore - no types
import Press from "vite-plugin-press"
const currentDir = path.dirname(fileURLToPath(import.meta.url))
// https://vitejs.dev/config/
export default defineConfig(async () => {
return {
plugins: [
svgr(),
mdx({
// See https://mdxjs.com/advanced/plugins
remarkPlugins: [
remarkFrontmatter,
remarkFencedCode,
remarkDirective,
remarkGfm,
remarkParse,
remarkPrism as any,
remarkContainers,
],
rehypePlugins: [
[rehypeRaw, {passThrough:['mdxjsEsm','mdxFlowExpression','mdxJsxFlowElement','mdxJsxTextElement','mdxTextExpression']}],
rehypeStringify,
],
}),
Pages({
extensions: ['tsx', 'mdx']
}),
react(),
Press({
baseUrl: env.NODE_ENV === 'development'
? 'https://localhost:5173'
: fs.existsSync('public/CNAME') ? 'https://' + fs.readFileSync('public/CNAME', 'utf-8').trim() : undefined,
metadataPath: 'public/api',
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
}
},
// assetsInclude: ['**/*.md'],
}
})