### What problem does this PR solve? feat: Configure the root directory alias #1739 ### 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):tags/v0.13.0
| import path from 'path'; | |||||
| import { defineConfig } from 'umi'; | import { defineConfig } from 'umi'; | ||||
| import { appName } from './src/conf.json'; | import { appName } from './src/conf.json'; | ||||
| import routes from './src/routes'; | import routes from './src/routes'; | ||||
| export default defineConfig({ | export default defineConfig({ | ||||
| title: appName, | title: appName, | ||||
| outputPath: 'dist', | outputPath: 'dist', | ||||
| // alias: { '@': './src' }, | |||||
| alias: { root: path.resolve('../') }, | |||||
| npmClient: 'npm', | npmClient: 'npm', | ||||
| base: '/', | base: '/', | ||||
| routes, | routes, | 
| import HightLightMarkdown from '@/components/highlight-markdown'; | import HightLightMarkdown from '@/components/highlight-markdown'; | ||||
| import { useSetModalState, useTranslate } from '@/hooks/common-hooks'; | import { useSetModalState, useTranslate } from '@/hooks/common-hooks'; | ||||
| import { Button, Card, Flex, Space } from 'antd'; | import { Button, Card, Flex, Space } from 'antd'; | ||||
| import apiDoc from '../../../../../docs/references/api.md'; | |||||
| // import apiDoc from '../../../../../api/http_api.md'; | |||||
| import apiDoc from 'root/api/http_api.md'; | |||||
| import ChatApiKeyModal from '../chat-api-key-modal'; | import ChatApiKeyModal from '../chat-api-key-modal'; | ||||
| import EmbedModal from '../embed-modal'; | import EmbedModal from '../embed-modal'; | ||||
| import { usePreviewChat, useShowEmbedModal } from '../hooks'; | import { usePreviewChat, useShowEmbedModal } from '../hooks'; | 
| li { | li { | ||||
| padding: 4px 0px; | padding: 4px 0px; | ||||
| } | } | ||||
| p { | |||||
| white-space: pre-wrap; // https://stackoverflow.com/questions/60332183/new-line-with-react-markdown | |||||
| } | |||||
| // p { | |||||
| // white-space: pre-wrap; // https://stackoverflow.com/questions/60332183/new-line-with-react-markdown | |||||
| // } | |||||
| } | } | ||||
| .code { | .code { | 
| { | { | ||||
| "extends": "./src/.umi/tsconfig.json", | "extends": "./src/.umi/tsconfig.json", | ||||
| "@@/*": ["src/.umi/*"], | "@@/*": ["src/.umi/*"], | ||||
| "root": ["../*"], | |||||
| } | } |