All checks were successful
test/timeline-frontend/pipeline/head This commit looks good
- 实现评论系统,包括评论输入、列表展示和集成指南 - 添加反应功能组件(ReactionBar、ReactionButton、ReactionPicker) - 实现离线编辑支持,包括同步状态管理和冲突解决 - 添加主题定制功能,支持多种配色方案和主题预览 - 新增多视图布局选项(时间线、分组、砌体视图) - 实现个人资料编辑器,支持头像、简介和自定义字段编辑 - 添加统计页面,展示存储使用情况和上传趋势 - 新增相册管理功能,支持相册创建、编辑和照片管理 - 实现响应式设计和加载骨架屏组件 - 扩展国际化支持,新增孟加拉语、波斯语、印尼语、日语、葡萄牙语等语言 - 添加错误边界组件和离线指示器 - 更新配置文件、路由和依赖项 - 新增完整的文档、测试用例和集成指南
216 lines
6.6 KiB
TypeScript
216 lines
6.6 KiB
TypeScript
// https://umijs.org/config/
|
||
import { defineConfig } from 'umi';
|
||
import { join } from 'path';
|
||
import defaultSettings from './defaultSettings';
|
||
import proxy from './proxy';
|
||
|
||
import routes from './routes';
|
||
|
||
const { REACT_APP_ENV = 'dev' } = process.env;
|
||
|
||
export default defineConfig({
|
||
/**
|
||
* @name 开启 hash 模式
|
||
* @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。
|
||
* @doc https://umijs.org/docs/api/config#hash
|
||
*/
|
||
hash: true,
|
||
|
||
/**
|
||
* @name 兼容性设置
|
||
* @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖
|
||
* @doc https://umijs.org/docs/api/config#targets
|
||
*/
|
||
// targets: {
|
||
// ie: 11,
|
||
// },
|
||
/**
|
||
* @name 路由的配置,不在路由中引入的文件不会编译
|
||
* @description 只支持 path,component,routes,redirect,wrappers,title 的配置
|
||
* @doc https://umijs.org/docs/guides/routes
|
||
*/
|
||
// umi routes: https://umijs.org/docs/routing
|
||
routes,
|
||
/**
|
||
* @name 主题的配置
|
||
* @description 虽然叫主题,但是其实只是 less 的变量设置
|
||
* @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn
|
||
* @doc umi 的theme 配置 https://umijs.org/docs/api/config#theme
|
||
*/
|
||
theme: {
|
||
// 如果不想要 configProvide 动态设置主题需要把这个设置为 default
|
||
// 只有设置为 variable, 才能使用 configProvide 动态设置主色调
|
||
'root-entry-name': 'variable',
|
||
},
|
||
/**
|
||
* @name moment 的国际化配置
|
||
* @description 如果对国际化没有要求,打开之后能减少js的包大小
|
||
* @doc https://umijs.org/docs/api/config#ignoremomentlocale
|
||
*/
|
||
ignoreMomentLocale: true,
|
||
/**
|
||
* @name 代理配置
|
||
* @description 可以让你的本地服务器代理到你的服务器上,这样你就可以访问服务器的数据了
|
||
* @see 要注意以下 代理只能在本地开发时使用,build 之后就无法使用了。
|
||
* @doc 代理介绍 https://umijs.org/docs/guides/proxy
|
||
* @doc 代理配置 https://umijs.org/docs/api/config#proxy
|
||
*/
|
||
proxy: proxy[REACT_APP_ENV as keyof typeof proxy],
|
||
/**
|
||
* @name 快速热更新配置
|
||
* @description 一个不错的热更新组件,更新时可以保留 state
|
||
*/
|
||
fastRefresh: true,
|
||
//============== 以下都是max的插件配置 ===============
|
||
/**
|
||
* @name 数据流插件
|
||
* @@doc https://umijs.org/docs/max/data-flow
|
||
*/
|
||
model: {},
|
||
/**
|
||
* 一个全局的初始数据流,可以用它在插件之间共享数据
|
||
* @description 可以用来存放一些全局的数据,比如用户信息,或者一些全局的状态,全局初始状态在整个 Umi 项目的最开始创建。
|
||
* @doc https://umijs.org/docs/max/data-flow#%E5%85%A8%E5%B1%80%E5%88%9D%E5%A7%8B%E7%8A%B6%E6%80%81
|
||
*/
|
||
initialState: {},
|
||
/**
|
||
* @name layout 插件
|
||
* @doc https://umijs.org/docs/max/layout-menu
|
||
*/
|
||
title: 'Timeline',
|
||
layout: {
|
||
locale: true,
|
||
...defaultSettings,
|
||
},
|
||
/**
|
||
* @name moment2dayjs 插件
|
||
* @description 将项目中的 moment 替换为 dayjs
|
||
* @doc https://umijs.org/docs/max/moment2dayjs
|
||
*/
|
||
moment2dayjs: {
|
||
preset: 'antd',
|
||
plugins: ['duration'],
|
||
},
|
||
/**
|
||
* @name 国际化插件
|
||
* @doc https://umijs.org/docs/max/i18n
|
||
*/
|
||
locale: {
|
||
// default zh-CN
|
||
default: 'zh-CN',
|
||
antd: true,
|
||
// default true, when it is true, will use `navigator.language` overwrite default
|
||
baseNavigator: true,
|
||
},
|
||
/**
|
||
* @name antd 插件
|
||
* @description 内置了 babel import 插件
|
||
* @doc https://umijs.org/docs/max/antd#antd
|
||
*/
|
||
antd: {},
|
||
/**
|
||
* @name 网络请求配置
|
||
* @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。
|
||
* @doc https://umijs.org/docs/max/request
|
||
*/
|
||
request: {},
|
||
/**
|
||
* @name 权限插件
|
||
* @description 基于 initialState 的权限插件,必须先打开 initialState
|
||
* @doc https://umijs.org/docs/max/access
|
||
*/
|
||
access: {},
|
||
/**
|
||
* @name <head> 中额外的 script
|
||
* @description 配置 <head> 中额外的 script
|
||
*/
|
||
headScripts: [
|
||
// 解决首次加载时白屏的问题
|
||
{ src: '/scripts/loading.js', async: true },
|
||
],
|
||
//================ pro 插件配置 =================
|
||
presets: ['umi-presets-pro'],
|
||
/**
|
||
* @name openAPI 插件的配置
|
||
* @description 基于 openapi 的规范生成serve 和mock,能减少很多样板代码
|
||
* @doc https://pro.ant.design/zh-cn/docs/openapi/
|
||
*/
|
||
openAPI: [
|
||
{
|
||
requestLibPath: "import { request } from '@umijs/max'",
|
||
// 或者使用在线的版本
|
||
// schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
|
||
schemaPath: join(__dirname, 'oneapi.json'),
|
||
mock: false,
|
||
},
|
||
{
|
||
requestLibPath: "import { request } from '@umijs/max'",
|
||
schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
|
||
projectName: 'swagger',
|
||
},
|
||
],
|
||
mock: {
|
||
include: ['mock/**/*', 'src/pages/**/_mock.ts'],
|
||
},
|
||
|
||
esbuildMinifyIIFE: true,
|
||
requestRecord: {},
|
||
|
||
/**
|
||
* @name Webpack configuration
|
||
* @description Custom webpack configuration for code splitting and optimization
|
||
*/
|
||
chainWebpack: (config: any) => {
|
||
// Ignore Windows system files to prevent Watchpack errors
|
||
config.watchOptions({
|
||
ignored: [
|
||
'**/node_modules',
|
||
'**/.git',
|
||
'**/C:/DumpStack.log.tmp',
|
||
'**/C:/pagefile.sys',
|
||
'**/C:/swapfile.sys',
|
||
'**/C:/System Volume Information',
|
||
'**/C:/$*', // Ignore all system files starting with $
|
||
],
|
||
});
|
||
|
||
// Split large vendor libraries into separate chunks
|
||
config.optimization.splitChunks({
|
||
chunks: 'all',
|
||
cacheGroups: {
|
||
// Ant Design and related libraries
|
||
antd: {
|
||
name: 'antd',
|
||
test: /[\\/]node_modules[\\/](@ant-design|antd|@antv|rc-)/,
|
||
priority: 20,
|
||
},
|
||
// React and related libraries
|
||
react: {
|
||
name: 'react',
|
||
test: /[\\/]node_modules[\\/](react|react-dom|react-router|react-router-dom)/,
|
||
priority: 20,
|
||
},
|
||
// Other vendor libraries
|
||
vendors: {
|
||
name: 'vendors',
|
||
test: /[\\/]node_modules[\\/]/,
|
||
priority: 10,
|
||
},
|
||
},
|
||
});
|
||
|
||
// Optimize images
|
||
config.module
|
||
.rule('images')
|
||
.test(/\.(png|jpe?g|gif|webp|svg)$/)
|
||
.use('url-loader')
|
||
.loader('url-loader')
|
||
.options({
|
||
limit: 8192, // Inline images smaller than 8KB
|
||
name: 'static/images/[name].[hash:8].[ext]',
|
||
});
|
||
|
||
return config;
|
||
},
|
||
});
|