balibabu commited on
Commit
a1d0b3e
·
1 Parent(s): 1006946

feat: Load markdown file with "asset/source" #1739 (#2880)

Browse files

### What problem does this PR solve?

feat: Load markdown file with "asset/source" #17339

### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):

web/.umirc.ts CHANGED
@@ -6,7 +6,7 @@ import routes from './src/routes';
6
  export default defineConfig({
7
  title: appName,
8
  outputPath: 'dist',
9
- alias: { root: path.resolve('../') },
10
  npmClient: 'npm',
11
  base: '/',
12
  routes,
@@ -26,9 +26,6 @@ export default defineConfig({
26
  hack: `true; @import "~@/less/index.less";`,
27
  },
28
  },
29
- mdx: {
30
- loader: 'remark-loader',
31
- },
32
  devtool: 'source-map',
33
  copy: ['src/conf.json'],
34
  proxy: {
@@ -41,14 +38,7 @@ export default defineConfig({
41
  },
42
  },
43
  chainWebpack(memo, args) {
44
- memo.module
45
- .rule('markdown')
46
- .test(/\.md$/)
47
- .use('html-loader')
48
- .loader('html-loader')
49
- .end()
50
- .use('remark-loader')
51
- .loader('remark-loader');
52
 
53
  return memo;
54
  },
 
6
  export default defineConfig({
7
  title: appName,
8
  outputPath: 'dist',
9
+ alias: { '@parent': path.resolve(__dirname, '../') },
10
  npmClient: 'npm',
11
  base: '/',
12
  routes,
 
26
  hack: `true; @import "~@/less/index.less";`,
27
  },
28
  },
 
 
 
29
  devtool: 'source-map',
30
  copy: ['src/conf.json'],
31
  proxy: {
 
38
  },
39
  },
40
  chainWebpack(memo, args) {
41
+ memo.module.rule('markdown').test(/\.md$/).type('asset/source');
 
 
 
 
 
 
 
42
 
43
  return memo;
44
  },
web/src/components/api-service/chat-overview-modal/api-content.tsx CHANGED
@@ -2,7 +2,7 @@ import HightLightMarkdown from '@/components/highlight-markdown';
2
  import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
3
  import { Button, Card, Flex, Space } from 'antd';
4
  // import apiDoc from '../../../../../api/http_api.md';
5
- import apiDoc from 'root/api/http_api.md';
6
  import ChatApiKeyModal from '../chat-api-key-modal';
7
  import EmbedModal from '../embed-modal';
8
  import { usePreviewChat, useShowEmbedModal } from '../hooks';
 
2
  import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
3
  import { Button, Card, Flex, Space } from 'antd';
4
  // import apiDoc from '../../../../../api/http_api.md';
5
+ import apiDoc from '@parent/api/http_api.md';
6
  import ChatApiKeyModal from '../chat-api-key-modal';
7
  import EmbedModal from '../embed-modal';
8
  import { usePreviewChat, useShowEmbedModal } from '../hooks';