From e3f72b06f6be0cb77489b95c185f4615970e2767 Mon Sep 17 00:00:00 2001 From: balibabu Date: Thu, 17 Oct 2024 16:03:13 +0800 Subject: [PATCH] feat: Load markdown file with "asset/source" #1739 (#2880) ### 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 | 14 ++------------ .../chat-overview-modal/api-content.tsx | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/web/.umirc.ts b/web/.umirc.ts index 5bdb2041704..e27f5dff8af 100644 --- a/web/.umirc.ts +++ b/web/.umirc.ts @@ -6,7 +6,7 @@ import routes from './src/routes'; export default defineConfig({ title: appName, outputPath: 'dist', - alias: { root: path.resolve('../') }, + alias: { '@parent': path.resolve(__dirname, '../') }, npmClient: 'npm', base: '/', routes, @@ -26,9 +26,6 @@ export default defineConfig({ hack: `true; @import "~@/less/index.less";`, }, }, - mdx: { - loader: 'remark-loader', - }, devtool: 'source-map', copy: ['src/conf.json'], proxy: { @@ -41,14 +38,7 @@ export default defineConfig({ }, }, chainWebpack(memo, args) { - memo.module - .rule('markdown') - .test(/\.md$/) - .use('html-loader') - .loader('html-loader') - .end() - .use('remark-loader') - .loader('remark-loader'); + memo.module.rule('markdown').test(/\.md$/).type('asset/source'); return memo; }, diff --git a/web/src/components/api-service/chat-overview-modal/api-content.tsx b/web/src/components/api-service/chat-overview-modal/api-content.tsx index b620599ca95..08730d64bb0 100644 --- a/web/src/components/api-service/chat-overview-modal/api-content.tsx +++ b/web/src/components/api-service/chat-overview-modal/api-content.tsx @@ -2,7 +2,7 @@ import HightLightMarkdown from '@/components/highlight-markdown'; import { useSetModalState, useTranslate } from '@/hooks/common-hooks'; import { Button, Card, Flex, Space } from 'antd'; // import apiDoc from '../../../../../api/http_api.md'; -import apiDoc from 'root/api/http_api.md'; +import apiDoc from '@parent/api/http_api.md'; import ChatApiKeyModal from '../chat-api-key-modal'; import EmbedModal from '../embed-modal'; import { usePreviewChat, useShowEmbedModal } from '../hooks';