rspress.config.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import * as path from 'node:path';
  6. import { merge } from 'webpack-merge';
  7. import { defineConfig } from 'rspress/config';
  8. // import { pluginLlms } from '@rspress/plugin-llms';
  9. export default defineConfig({
  10. root: path.join(__dirname, 'src'),
  11. base: '/',
  12. title: 'FlowGram.AI',
  13. globalStyles: path.join(__dirname, './global.less'),
  14. route: {
  15. exclude: ['./global.d.ts'],
  16. },
  17. builderConfig: {
  18. source: {
  19. decorators: {
  20. version: 'legacy',
  21. },
  22. },
  23. tools: {
  24. rspack(options) {
  25. return merge(options, {
  26. module: {
  27. rules: [
  28. {
  29. test: /\.mdc$/,
  30. type: 'asset/source',
  31. },
  32. {
  33. resourceQuery: /raw/,
  34. type: 'asset/source',
  35. },
  36. ],
  37. },
  38. // 禁用 ES 模块输出(启用 CommonJS)
  39. experiments: {
  40. outputModule: false,
  41. },
  42. // 允许省略文件扩展名
  43. resolve: {
  44. fullySpecified: false,
  45. },
  46. });
  47. },
  48. },
  49. },
  50. ssg: false,
  51. // locales 为一个对象数组
  52. locales: [
  53. {
  54. lang: 'en',
  55. // 导航栏切换语言的标签
  56. label: 'English',
  57. title: 'Rspress',
  58. description: 'Static Site Generator',
  59. },
  60. {
  61. lang: 'zh',
  62. label: '简体中文',
  63. title: 'Rspress',
  64. description: '静态网站生成器',
  65. },
  66. ],
  67. icon: '/logo.png',
  68. logo: {
  69. light: '/logo.png',
  70. dark: '/logo.png',
  71. },
  72. lang: 'zh',
  73. logoText: 'FlowGram.AI',
  74. plugins: [
  75. // pluginLlms({
  76. // llmsTxt: true,
  77. // llmsFullTxt: true,
  78. // }),
  79. ],
  80. themeConfig: {
  81. localeRedirect: 'auto',
  82. footer: {
  83. message: '© 2025 Bytedance Inc. All Rights Reserved.',
  84. },
  85. lastUpdated: true,
  86. locales: [
  87. {
  88. lang: 'en',
  89. label: 'en',
  90. outlineTitle: 'ON THIS Page',
  91. },
  92. {
  93. lang: 'zh',
  94. label: 'zh',
  95. outlineTitle: '大纲',
  96. searchNoResultsText: '未搜索到相关结果',
  97. searchPlaceholderText: '搜索文档',
  98. searchSuggestedQueryText: '可更换不同的关键字后重试',
  99. overview: {
  100. filterNameText: '过滤',
  101. filterPlaceholderText: '输入关键词',
  102. filterNoResultText: '未找到匹配的 API',
  103. },
  104. },
  105. ],
  106. socialLinks: [
  107. {
  108. icon: 'github',
  109. mode: 'link',
  110. content: 'https://github.com/bytedance/flowgram.ai',
  111. },
  112. {
  113. icon: 'discord',
  114. mode: 'link',
  115. content: 'https://discord.gg/SwDWdrgA9f',
  116. },
  117. {
  118. icon: 'X',
  119. mode: 'link',
  120. content: 'https://x.com/FlowGramAI',
  121. },
  122. ],
  123. },
  124. });