config.mts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. import { defineConfig } from 'vitepress'
  2. import VueMacros from 'unplugin-vue-macros/vite'
  3. import path from 'node:path';
  4. import { fileURLToPath, URL } from 'node:url'
  5. import { mdPlugin } from './config/plugins'
  6. import vueJsx from '@vitejs/plugin-vue-jsx';
  7. import { MarkdownTransform } from './plugins/markdown-transform';
  8. // https://vitepress.dev/reference/site-config
  9. export default defineConfig({
  10. vite: {
  11. css: {
  12. preprocessorOptions: {
  13. scss: {
  14. silenceDeprecations: ['legacy-js-api'],
  15. },
  16. },
  17. },
  18. resolve: {
  19. alias: [
  20. {
  21. find: /^ant-design-x-vue$/,
  22. replacement: path.resolve(__dirname, '../../src')
  23. },
  24. {
  25. find: /^dayjs\/plugin\/quarterOfYear$/,
  26. replacement: 'dayjs/esm/plugin/quarterOfYear'
  27. },
  28. {
  29. find: /^dayjs\/plugin\/weekYear$/,
  30. replacement: 'dayjs/esm/plugin/weekYear'
  31. },
  32. {
  33. find: /^dayjs\/plugin\/weekOfYear$/,
  34. replacement: 'dayjs/esm/plugin/weekOfYear'
  35. },
  36. {
  37. find: /^dayjs\/plugin\/localeData$/,
  38. replacement: 'dayjs/esm/plugin/localeData'
  39. },
  40. {
  41. find: /^dayjs\/plugin\/weekday$/,
  42. replacement: 'dayjs/esm/plugin/weekday'
  43. },
  44. {
  45. find: /^dayjs\/plugin\/advancedFormat$/,
  46. replacement: 'dayjs/esm/plugin/advancedFormat'
  47. },
  48. {
  49. find: /^dayjs\/plugin\/customParseFormat$/,
  50. replacement: 'dayjs/esm/plugin/customParseFormat'
  51. },
  52. {
  53. find: /^dayjs$/,
  54. replacement: 'dayjs/esm'
  55. },
  56. {
  57. find: /^.*\/VPHero\.vue$/,
  58. replacement: fileURLToPath(
  59. new URL('./vitepress/components/vp-hero.vue', import.meta.url)
  60. )
  61. }
  62. ]
  63. },
  64. ssr: {
  65. noExternal: ['ant-design-vue', '@ant-design/icons-vue'], // 避免打包为 CommonJS
  66. },
  67. build: {
  68. rollupOptions: {
  69. output: {
  70. globals: {
  71. 'ant-design-vue': 'AntDesignVue',
  72. },
  73. },
  74. },
  75. },
  76. plugins: [
  77. VueMacros({
  78. plugins: {
  79. vueJsx: vueJsx(),
  80. },
  81. // 覆盖插件选项
  82. }),
  83. MarkdownTransform(),
  84. ],
  85. },
  86. markdown: {
  87. config: (md) => mdPlugin(md),
  88. },
  89. /* title: "Ant Design X Vue", */
  90. description: "Ant Design X For Vue",
  91. appearance: 'dark',
  92. themeConfig: {
  93. // https://vitepress.dev/reference/default-theme-config
  94. /* logo: 'https://mdn.alipayobjects.com/huamei_iwk9zp/afts/img/A*eco6RrQhxbMAAAAAAAAAAAAADgCCAQ/original', */
  95. nav: [
  96. /* { text: '研发', link: '/development/introduce' },
  97. { text: '组件', link: '/component/overview' }, */
  98. { text: '演示', link: '/playground/independent' },
  99. /* {
  100. text: '更多',
  101. items: [
  102. { text: 'Ant Design X of React', link: 'https://x.ant.design/index-cn' },
  103. { text: 'Ant Design Vue', link: 'https://www.antdv.com/components/overview-cn' },
  104. ]
  105. } */
  106. ],
  107. /* outline: [2, 3], */
  108. sidebar: {
  109. /* '/development': [
  110. {
  111. text: 'Ant Design X of Vue',
  112. link: '/development/introduce'
  113. },
  114. ],
  115. '/component/': [
  116. {
  117. text: '总览',
  118. link: '/component/overview'
  119. },
  120. {
  121. text: '通用',
  122. items: [
  123. { text: 'Bubble 对话气泡框', link: '/component/bubble' },
  124. { text: 'Conversations 管理对话', link: '/component/conversations' }
  125. ]
  126. },
  127. {
  128. text: '唤醒',
  129. items: [
  130. { text: 'Welcome 欢迎', link: '/component/welcome' },
  131. { text: 'Prompts 提示集', link: '/component/prompts' }
  132. ]
  133. },
  134. {
  135. text: '表达',
  136. items: [
  137. { text: 'Sender 输入框', link: '/component/sender' },
  138. { text: 'Attachments 输入附件', link: '/component/attachments' },
  139. { text: 'Suggestion 快捷指令', link: '/component/suggestion' }
  140. ]
  141. },
  142. {
  143. text: '确认',
  144. items: [
  145. { text: 'ThoughtChain 思维链', link: '/component/thought-chain' }
  146. ]
  147. },
  148. {
  149. text: '工具',
  150. items: [
  151. { text: 'useXAgent 模型调度', link: '/component/use-x-agent' },
  152. { text: 'useXChat 数据管理', link: '/component/use-x-chat' },
  153. { text: 'XStream 流', link: '/component/x-stream' },
  154. { text: 'XRequest 请求', link: '/component/x-request' },
  155. { text: 'XProvider 全局化配置', link: '/component/x-provider' }
  156. ]
  157. },
  158. ], */
  159. /* '/playground/': [
  160. {
  161. text: '样板间',
  162. items: [
  163. { text: '独立式', link: '/playground/independent' }
  164. ]
  165. },
  166. ] */
  167. },
  168. /* socialLinks: [
  169. { icon: 'github', link: 'https://github.com/wzc520pyfm/ant-design-x-vue' }
  170. ] */
  171. }
  172. })