rspress.config.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import * as path from 'node:path';
  2. import { defineConfig } from 'rspress/config';
  3. export default defineConfig({
  4. root: path.join(__dirname, 'src'),
  5. base: '/',
  6. title: 'FlowGram.AI',
  7. globalStyles: path.join(__dirname, './global.less'),
  8. builderConfig: {
  9. tools: {
  10. rspack: {
  11. optimization: {
  12. splitChunks: {
  13. chunks: 'all', // 拆分所有模块,包括异步和同步
  14. minSize: 30 * 1024, // 30KB 以下不拆分
  15. maxSize: 500 * 1024, // 500KB 以上强制拆分
  16. minChunks: 1, // 最少被引用 1 次就可以拆分
  17. automaticNameDelimiter: '-',
  18. cacheGroups: {
  19. vendors: {
  20. test: /[\\/]node_modules[\\/]/,
  21. name: 'vendors',
  22. chunks: 'all',
  23. priority: -10, // 优先级
  24. },
  25. },
  26. },
  27. },
  28. // 禁用 ES 模块输出(启用 CommonJS)
  29. experiments: {
  30. outputModule: false,
  31. },
  32. // 允许省略文件扩展名
  33. resolve: {
  34. fullySpecified: false,
  35. },
  36. },
  37. },
  38. },
  39. ssg: false,
  40. // locales 为一个对象数组
  41. locales: [
  42. {
  43. lang: 'en',
  44. // 导航栏切换语言的标签
  45. label: 'English',
  46. title: 'Rspress',
  47. description: 'Static Site Generator',
  48. },
  49. {
  50. lang: 'zh',
  51. label: '简体中文',
  52. title: 'Rspress',
  53. description: '静态网站生成器',
  54. },
  55. ],
  56. icon: '/logo.png',
  57. logo: {
  58. light: '/logo.png',
  59. dark: '/logo.png',
  60. },
  61. lang: 'zh',
  62. logoText: 'FlowGram.AI',
  63. plugins: [],
  64. themeConfig: {
  65. localeRedirect: 'auto',
  66. footer: {
  67. message: '© 2025 Bytedance Inc. All Rights Reserved.',
  68. },
  69. lastUpdated: true,
  70. locales: [
  71. {
  72. lang: 'en',
  73. label: 'en',
  74. outlineTitle: 'ON THIS Page',
  75. },
  76. {
  77. lang: 'zh',
  78. label: 'zh',
  79. outlineTitle: '大纲',
  80. searchNoResultsText: '未搜索到相关结果',
  81. searchPlaceholderText: '搜索文档',
  82. searchSuggestedQueryText: '可更换不同的关键字后重试',
  83. overview: {
  84. filterNameText: '过滤',
  85. filterPlaceholderText: '输入关键词',
  86. filterNoResultText: '未找到匹配的 API',
  87. },
  88. },
  89. ],
  90. socialLinks: [
  91. {
  92. icon: 'github',
  93. mode: 'link',
  94. content: 'https://github.com/bytedance/flowgram.ai',
  95. },
  96. {
  97. icon: 'discord',
  98. mode: 'link',
  99. content: 'https://discord.gg/SwDWdrgA9f',
  100. },
  101. {
  102. icon: 'X',
  103. mode: 'link',
  104. content: 'https://x.com/FlowGramAI',
  105. },
  106. ],
  107. },
  108. });