-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.ts
48 lines (44 loc) · 1.07 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
import path from 'path'
import { defineConfig } from 'vite'
import Pages from 'vite-plugin-pages'
import WindiCSS from 'vite-plugin-windicss'
import viteSSR from 'vite-ssr/plugin'
import mdx from 'vite-plugin-mdx'
// @ts-ignore
import remarkPrism from 'remark-prism'
import reactRefresh from '@vitejs/plugin-react-refresh'
// @ts-ignore
import getPageProps from './serverless/api/get-page-props'
export default defineConfig({
resolve: {
alias: {
'~/': `${path.resolve(__dirname, 'src')}/`,
},
},
plugins: [
reactRefresh(),
viteSSR(),
mdx({
remarkPlugins: [remarkPrism],
}),
{
name: 'API-mock',
configureServer({ middlewares }) {
middlewares.use('/api/get-page-props', getPageProps)
},
},
// https://github.com/hannoeru/vite-plugin-pages
Pages({
react: true,
extensions: ['jsx', 'tsx', 'mdx'],
}),
// https://github.com/antfu/vite-plugin-windicss
WindiCSS({
safelist: 'prose prose-sm m-auto',
}),
],
optimizeDeps: {
include: ['@mdx-js/react'],
exclude: [],
},
})