generator-mico-cli 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generators/micro-react/templates/apps/layout/config/config.prod.development.ts +54 -0
- package/generators/micro-react/templates/apps/layout/package.json +2 -2
- package/generators/subapp-react/templates/homepage/config/config.prod.testing.ts +40 -0
- package/generators/subapp-react/templates/homepage/package.json +2 -2
- package/package.json +1 -1
- /package/generators/micro-react/templates/apps/layout/config/{config.testing.ts → config.prod.testing.ts} +0 -0
- /package/generators/subapp-react/templates/homepage/config/{config.testing.ts → config.prod.development.ts} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// https://umijs.org/config/
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from '@umijs/max';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
|
|
7
|
+
// 使用 fs 读取 JSON 避免成为配置依赖,修改 menus.json 不会触发服务器重启
|
|
8
|
+
const mockMenus = JSON.parse(
|
|
9
|
+
fs.readFileSync(path.join(__dirname, '../mock/menus.json'), 'utf-8'),
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const config: ReturnType<typeof defineConfig> = {
|
|
13
|
+
publicPath: '/',
|
|
14
|
+
/**
|
|
15
|
+
* @name 注入到 HTML head 的脚本
|
|
16
|
+
* @description 开发环境注入 mock 菜单数据
|
|
17
|
+
* @doc https://umijs.org/docs/api/config#headscripts
|
|
18
|
+
*/
|
|
19
|
+
headScripts: [
|
|
20
|
+
{
|
|
21
|
+
content: `
|
|
22
|
+
window.__MICO_MENUS__ = ${JSON.stringify(mockMenus)};
|
|
23
|
+
window.__MICO_CONFIG__ = {
|
|
24
|
+
appName: 'Audit Center',
|
|
25
|
+
apiBaseUrl: '',
|
|
26
|
+
};
|
|
27
|
+
`,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
proxy: {
|
|
32
|
+
'/api/': {
|
|
33
|
+
// 要代理的地址
|
|
34
|
+
target: 'https://preview.pro.ant.design',
|
|
35
|
+
// 配置了这个可以从 http 代理到 https
|
|
36
|
+
// 依赖 origin 的功能可能需要这个,比如 cookie
|
|
37
|
+
changeOrigin: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
define: {
|
|
41
|
+
'process.env.NODE_ENV': 'development',
|
|
42
|
+
'process.env.APP_ID': 'mibot_dev',
|
|
43
|
+
'process.env.API_BASE_URL': 'https://dashboard-api-test.micoplatform.com',
|
|
44
|
+
'process.env.PROXY_SUFFIX': '/',
|
|
45
|
+
'process.env.LOGIN_ENDPOINT':
|
|
46
|
+
'',
|
|
47
|
+
'process.env.REFRESH_ENDPOINT':
|
|
48
|
+
'',
|
|
49
|
+
'process.env.EXTERNAL_LOGIN_PATH':
|
|
50
|
+
'',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default defineConfig(config);
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"author": "Easton <easton@micous.com>",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run build:production",
|
|
7
|
-
"build:development": "cross-env UMI_ENV=
|
|
8
|
-
"build:production": "cross-env UMI_ENV=
|
|
7
|
+
"build:development": "cross-env UMI_ENV=development max build",
|
|
8
|
+
"build:production": "cross-env UMI_ENV=production max build",
|
|
9
9
|
"build:testing": "cross-env UMI_ENV=testing max build",
|
|
10
10
|
"dev": "npm run start:development",
|
|
11
11
|
"format": "prettier --cache --write .",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// https://umijs.org/config/
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from '@umijs/max';
|
|
4
|
+
const { CDN_PUBLIC_PATH } = process.env;
|
|
5
|
+
|
|
6
|
+
const PUBLIC_PATH: string = CDN_PUBLIC_PATH
|
|
7
|
+
? `${CDN_PUBLIC_PATH.replace(/\/?$/, '/')}homepage/`
|
|
8
|
+
: '/homepage/';
|
|
9
|
+
|
|
10
|
+
const config: ReturnType<typeof defineConfig> = {
|
|
11
|
+
// 测试环境:将所有代码打包到一个文件
|
|
12
|
+
extraBabelPlugins: ['babel-plugin-dynamic-import-node'],
|
|
13
|
+
|
|
14
|
+
// 禁用代码分割,只输出一个 JS 和一个 CSS
|
|
15
|
+
chainWebpack(memo) {
|
|
16
|
+
// 禁用 splitChunks
|
|
17
|
+
memo.optimization.splitChunks(false);
|
|
18
|
+
// 禁用 runtimeChunk
|
|
19
|
+
memo.optimization.runtimeChunk(false);
|
|
20
|
+
return memo;
|
|
21
|
+
},
|
|
22
|
+
publicPath: PUBLIC_PATH,
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @name 外部依赖配置
|
|
26
|
+
* @description 将大型公共库排除打包,运行时从主应用获取
|
|
27
|
+
* @doc https://umijs.org/docs/api/config#externals
|
|
28
|
+
*
|
|
29
|
+
* 作为 qiankun 子应用时,这些库由主应用提供:
|
|
30
|
+
* - react / react-dom: 主应用已加载,避免多实例问题
|
|
31
|
+
* - @arco-design/web-react: 主应用已加载,复用组件和样式
|
|
32
|
+
*/
|
|
33
|
+
externals: {
|
|
34
|
+
react: 'React',
|
|
35
|
+
'react-dom': 'ReactDOM',
|
|
36
|
+
'@arco-design/web-react': 'arco',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default defineConfig(config);
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "max dev",
|
|
8
8
|
"build": "npm run build:production",
|
|
9
|
-
"build:development": "cross-env UMI_ENV=
|
|
10
|
-
"build:production": "cross-env UMI_ENV=
|
|
9
|
+
"build:development": "cross-env UMI_ENV=development max build",
|
|
10
|
+
"build:production": "cross-env UMI_ENV=production max build",
|
|
11
11
|
"build:testing": "cross-env UMI_ENV=testing max build",
|
|
12
12
|
"postinstall": "max setup",
|
|
13
13
|
"setup": "max setup",
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|