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):
This commit is contained in:
balibabu 2024-10-17 16:03:13 +08:00 committed by GitHub
parent bedb05012d
commit 167b4af52b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 13 deletions

View File

@ -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;
},

View File

@ -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';