-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.umirc.ts
81 lines (78 loc) · 2.64 KB
/
.umirc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { BundlerConfigType, defineConfig } from 'umi';
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
import { getRoutes } from './src/configs/route.config';
const isProd = process.env.NODE_ENV === 'production';
const siteAlias = process.env.SITE_ALIAS;
const outputPath = isProd && siteAlias === 'cn' ? '分发' : 'dist';
const publicProdPrefix = siteAlias === 'cn' ? 'https://cdn.algoux.cn/rl/' : siteAlias === 'cnn' ? 'https://cdn.algoux.cn/rl/' : '/';
const publicPath = isProd ? `${publicProdPrefix}${outputPath}/` : `http://127.0.0.1:8000/${outputPath}/`;
console.log(
'Build options:',
JSON.stringify({
isProd,
siteAlias,
outputPath,
publicPath,
}),
);
export default defineConfig({
webpack5: {},
routes: [
{
path: '/',
component: '@/layouts/index',
routes: [...getRoutes(), { component: '@/pages/404' }],
},
],
nodeModulesTransform: {
type: 'none',
},
favicon: `/${outputPath}/favicon.ico`,
hash: true,
title: false,
antd: {},
define: {
'process.env.API_BASE_CLIENT': isProd ? 'https://rl-api.algoux.cn' : 'https://rl-api.algoux.cn',
'process.env.API_BASE_SERVER': isProd ? 'https://rl-api.algoux.cn' : 'https://rl-api.algoux.cn',
'process.env.CDN_API_BASE_CLIENT': isProd ? 'https://algoux-rl.cdn.blueverse.cc' : 'https://rl-api.algoux.cn',
'process.env.CDN_API_BASE_SERVER': isProd ? 'https://rl-api.algoux.cn' : 'https://rl-api.algoux.cn',
'process.env.WS_BASE': isProd ? 'wss://rl-api.algoux.cn' : 'wss://rl-api.algoux.cn',
'process.env.SITE_ALIAS': process.env.SITE_ALIAS,
'process.env.HOST_GLOBAL': 'rl.algoux.org',
'process.env.HOST_CN': 'rl.algoux.cn',
'process.env.BEIAN': '鲁ICP备18021776号-5',
'process.env.LIVE_POLLING_INTERVAL': '10000',
'process.env.X_PHOTO_BASE': 'https://share-bj-1252277595.cos.ap-beijing.myqcloud.com/srk-storage',
'GTAG': siteAlias === 'cn' ? 'G-D4PSNCRQJC' : 'G-D6CVTJBDZT',
},
ssr: {
devServerRender: false,
},
dynamicImport: {
loading: '@/components/Loading',
},
fastRefresh: {},
tailwindcss: {
tailwindCssFilePath: '@/tailwind.css',
},
outputPath,
publicPath,
// terserOptions: {
// compress: false,
// },
chainWebpack(memo, { type }) {
if (type === BundlerConfigType.csr) {
memo.plugin('MonacoWebpackPlugin').use(MonacoWebpackPlugin, [
{
languages: ['json'],
publicPath: `/${outputPath}`,
},
]);
}
if (type === BundlerConfigType.ssr) {
// disable all webpack minify
memo.optimization.minimize(false);
}
memo.module.rule('mjs-rule').test(/.m?js/).resolve.set('fullySpecified', false);
},
});