-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
64 lines (62 loc) · 1.62 KB
/
vite.config.ts
File metadata and controls
64 lines (62 loc) · 1.62 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import mdx from '@mdx-js/rollup'
import remarkFrontmatter from 'remark-frontmatter'
import rehypeSlug from 'rehype-slug'
import remarkGfm from 'remark-gfm'
import remarkToc from 'remark-toc'
import { viteMockServe } from 'vite-plugin-mock'
import { codeInspectorPlugin } from 'code-inspector-plugin'
const ReactCompilerConfig = { /* ... */ }
// https://vite.dev/config/
export default defineConfig({
base: '/react-components/',
resolve: {
alias: {
'@': '/src',
},
},
plugins: [
tailwindcss(),
codeInspectorPlugin({
bundler: 'vite',
editor: 'code',
showSwitch: true,
}),
react({
babel: {
plugins: [
["babel-plugin-react-compiler", ReactCompilerConfig],
],
},
}),
mdx({
include: /\.mdx$/,
remarkPlugins: [remarkFrontmatter, remarkGfm, [remarkToc, { heading: 'TOC|目录' }]],
rehypePlugins: [rehypeSlug],
providerImportSource: '@mdx-js/react'
}),
viteMockServe({
mockPath: 'mock',
enable: true,
}),
],
server: {
open: true
},
build: {
rollupOptions: {
output: {
manualChunks: {
echarts: ['echarts'],
'@uiw/react-codemirror': ['@uiw/react-codemirror'],
'react-markdown': ['react-markdown'],
'@mdx-js/react': ['@mdx-js/react'],
'react-syntax-highlighter': ['react-syntax-highlighter'],
'markdown-plugins': ['remark-frontmatter', 'remark-gfm', 'remark-toc', 'rehype-slug']
}
}
}
}
})