cloud-web-corejs 1.1.0-dev.33 → 1.1.0-dev.35
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/README.md +38 -0
- package/bin/core-resources.js +16 -0
- package/bin/create-child-app.js +34 -0
- package/docs/child-app/README.md +95 -0
- package/docs/child-app/activiti-resources.md +63 -0
- package/docs/child-app/generate-prompt.md +55 -0
- package/docs/child-app/luckysheet-resources.md +80 -0
- package/docs/child-app/public-resources-plan.md +288 -0
- package/docs/child-app/resources-implementation.md +101 -0
- package/docs/child-app/tinymce-resources.md +88 -0
- package/docs/child-app/validation.md +34 -0
- package/docs/qiankun/346/216/245/345/205/245/345/215/217/350/256/256.md +298 -0
- package/docs/qiankun/350/257/246/346/203/205/346/211/277/350/275/275/345/255/220/345/272/224/347/224/250/345/257/271/346/216/245/346/270/205/345/215/225.md +111 -0
- package/package.json +18 -2
- package/resource-tools/index.js +126 -0
- package/src/app-bootstrap.js +7 -2
- package/src/components/Tinymce/dynamicLoadScript.js +51 -59
- package/src/components/Tinymce/index.vue +382 -339
- package/src/components/code-editor/index.vue +361 -343
- package/src/components/luckysheet/loadResources.js +64 -0
- package/src/components/luckysheet/view.vue +239 -210
- package/src/components/xform/form-designer/form-widget/field-widget/dropdown-widget.vue +34 -3
- package/src/utils/featureResources.js +57 -0
- package/src/views/bd/setting/form_template/mixins/list.js +7 -6
- package/src/views/bd/setting/form_template/mixins/list2.js +412 -411
- package/src/views/bd/setting/form_template/mixins/wf_list.js +431 -430
- package/src/views/user/form/form_template/list.vue +513 -512
- package/src/views/user/wf/wf_obj_config/activiti_wf.vue +134 -133
- package/src/views/user/wf/wf_obj_config/list.vue +747 -746
- package/src/views/user/wf/wf_obj_config/list_form.vue +374 -373
- package/templates/child-app/.env +3 -0
- package/templates/child-app/README.md +49 -0
- package/templates/child-app/app.config.js +6 -0
- package/templates/child-app/babel.config.js +1 -0
- package/templates/child-app/core-resources.config.js +15 -0
- package/templates/child-app/gitignore +7 -0
- package/templates/child-app/package.json +34 -0
- package/templates/child-app/public/index.html +12 -0
- package/templates/child-app/src/assets/401_images/401.gif +0 -0
- package/templates/child-app/src/assets/404_images/404.png +0 -0
- package/templates/child-app/src/assets/404_images/404_cloud.png +0 -0
- package/templates/child-app/src/assets/logo.png +0 -0
- package/templates/child-app/src/corejsConfig.js +2 -0
- package/templates/child-app/src/icons/index.js +2 -0
- package/templates/child-app/src/icons/svg/child-demo.svg +1 -0
- package/templates/child-app/src/layout/index.vue +4 -0
- package/templates/child-app/src/main.js +5 -0
- package/templates/child-app/src/prefixConfig.js +13 -0
- package/templates/child-app/src/resources/css/login.scss +29 -0
- package/templates/child-app/src/resources/images/bg-login5.jpg +0 -0
- package/templates/child-app/src/resources/images/home-img.png +0 -0
- package/templates/child-app/src/router/modules/customer.js +3 -0
- package/templates/child-app/src/settings.js +24 -0
- package/templates/child-app/src/styles/app.scss +2 -0
- package/templates/child-app/src/views/demo/detail.vue +19 -0
- package/templates/child-app/src/views/demo/list.vue +38 -0
- package/templates/child-app/src/views/user/login/index.vue +18 -0
- package/templates/child-app/vue.config.js +107 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# cloud-web-corejs 子应用
|
|
2
|
+
|
|
3
|
+
本模板复用完整 Core 启动入口;不是独立组件库演示。技术栈为 Vue 2.6.12、Vue CLI 5、Vue Router 3、Vuex 3。使用 Node 20+;首次安装后提交 package-lock.json。
|
|
4
|
+
|
|
5
|
+
## 启动
|
|
6
|
+
|
|
7
|
+
1. 检查 `app.config.js`:appCode 与主应用注册表一致,package.json 的 name 在各应用之间保持唯一。
|
|
8
|
+
2. 在 `.env.development.local` 配置 `API_TARGET=https://实际后端网关`。默认 API 路径 `/api` 经开发代理剥除;按后端实际前缀调整 `src/prefixConfig.js`。
|
|
9
|
+
3. `npm install`,然后 `npm run dev`。
|
|
10
|
+
4. 打开 `http://localhost:17527/<appCode>/#/login`。默认登录组件需要真实后端登录配置、账号和权限;本模板没有假登录。
|
|
11
|
+
5. `npm run build:prod` 生成 `dist`,部署到 `/<appCode>/`。部署网关需提供 `/api` 转发,或构建时配置绝对 `VUE_APP_BASE_API`。
|
|
12
|
+
|
|
13
|
+
不要同时运行占用 17527 的另一个子应用。模板不依赖 DLL,无需复制 std 的 DLL、呼叫中心或业务 public 目录。
|
|
14
|
+
|
|
15
|
+
## 示例与菜单
|
|
16
|
+
|
|
17
|
+
`src/views/demo/list.vue` 是内存列表,支持筛选、新增和编辑。`detail.vue` 是本地弹框编辑器;没有实现远程业务保存,刷新即恢复初始数据。它不是跨应用详情回调协议的完整示例。
|
|
18
|
+
|
|
19
|
+
主应用逻辑参数 `micro_app_registry` 条目(替换 childapp):
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
[{ "appCode": "childapp", "appName": "业务子应用", "entry": "//child.example/childapp/", "enabled": true }]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
为有权限的账号配置普通页面菜单,访问路径使用 `/micro/childapp/demo/list`,组件来源为子应用 `src/views/demo/list.vue`。包内页面使用 `/micro/childapp/base/user/user/list`。保留实际系统的菜单 ID、父节点、普通菜单类型和权限字段;此处不是可直接提交的完整菜单 API 请求。只有表单菜单使用 `type === 5`。
|
|
26
|
+
|
|
27
|
+
联调需测试环境逻辑参数 `micro_debug_enabled=true`;访问主应用 `#/micro_debug/childapp/demo/list`,加载 `http://localhost:17527/`。注册表仍需包含该 appCode。
|
|
28
|
+
|
|
29
|
+
## 文件与资源
|
|
30
|
+
|
|
31
|
+
可选资源由 `core-resources.config.js` 声明,默认全部关闭。支持 Ace basic/full、TinyMCE full、Luckysheet full、Activiti full;安装独立资源制品并填写精确版本后启用。dev/build 自动准备、生产构建后自动校验。Activiti 仅支持主应用或非 qiankun 的同源页面,不支持 qiankun 菜单。详情见包内 `docs/child-app/` 的对应实施说明。
|
|
32
|
+
|
|
33
|
+
- `src/settings.js`、`prefixConfig.js`、`corejsConfig.js`、`router/modules/customer.js` 是包需要的应用扩展点。
|
|
34
|
+
- `src/layout/index.vue` 和 `src/views/user/login/index.vue` 转接包的默认布局、登录页。
|
|
35
|
+
- `src/assets` 与 `src/resources` 内少量图片是从 kCode 复用的默认品牌/错误页资源;包的动态视图上下文编译仍会引用它们。即使自定义首页,也不能随意删掉这些文件。上线前替换为本应用品牌。
|
|
36
|
+
- `src/icons` 存应用图标;Core 图标由包入口注册。
|
|
37
|
+
- Ace、TinyMCE、Luckysheet、Activiti、打印平台 SDK 等可选功能需要额外静态资源与部署配置,详见包内 `docs/child-app/README.md`。它们不在本模板中。
|
|
38
|
+
|
|
39
|
+
完整接入契约与生成提示词见 `node_modules/cloud-web-corejs/docs/child-app/`。
|
|
40
|
+
|
|
41
|
+
## 验收
|
|
42
|
+
|
|
43
|
+
- 干净安装、生产构建成功。
|
|
44
|
+
- 独立打开登录页;接真实后端后登录并进入已授权菜单。
|
|
45
|
+
- 主应用挂载、菜单切换保活、刷新、登出卸载、重新挂载。
|
|
46
|
+
- API 请求目标与 token 正确,异步 chunk 无 404,Core/应用图标和样式可见。
|
|
47
|
+
- 示例筛选和编辑正常;业务接口、上传及工作流按启用功能另行联调。
|
|
48
|
+
|
|
49
|
+
没有真实后端/宿主时,只能确认构建和浏览器启动;不能据此声明生产接入已验收。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = { presets: ["@vue/cli-plugin-babel/preset"] };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
schemaVersion: 1,
|
|
3
|
+
features: {
|
|
4
|
+
// Install the independent resource artifact before enabling:
|
|
5
|
+
// codeEditor: { package: "cloud-web-corejs-resources-ace", version: "1.11.0-core.0", profile: "basic" },
|
|
6
|
+
codeEditor: false,
|
|
7
|
+
// richText: { package: "cloud-web-corejs-resources-tinymce", version: "4.9.2-core.0", profile: "full" },
|
|
8
|
+
richText: false,
|
|
9
|
+
// spreadsheet: { package: "cloud-web-corejs-resources-luckysheet", version: "2.1.13-core.1", profile: "full" },
|
|
10
|
+
spreadsheet: false,
|
|
11
|
+
// Main application or non-qiankun same-origin page only; qiankun is rejected.
|
|
12
|
+
// workflowDesigner: { package: "cloud-web-corejs-resources-activiti", version: "5.17.0-core.1", profile: "full" },
|
|
13
|
+
workflowDesigner: false
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "corejs-child-starter",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"resources:prepare": "node node_modules/cloud-web-corejs/bin/core-resources.js prepare",
|
|
7
|
+
"resources:check": "node node_modules/cloud-web-corejs/bin/core-resources.js check",
|
|
8
|
+
"predev": "npm run resources:prepare",
|
|
9
|
+
"prebuild:prod": "npm run resources:prepare",
|
|
10
|
+
"postbuild:prod": "node node_modules/cloud-web-corejs/bin/core-resources.js check-dist",
|
|
11
|
+
"dev": "node --max-old-space-size=8192 node_modules/@vue/cli-service/bin/vue-cli-service.js serve",
|
|
12
|
+
"dev:micro": "npm run dev -- --port 17527",
|
|
13
|
+
"build:prod": "node --max-old-space-size=8192 node_modules/@vue/cli-service/bin/vue-cli-service.js build"
|
|
14
|
+
},
|
|
15
|
+
"engines": { "node": ">=20" },
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"cloud-web-corejs": "1.1.0-dev.27",
|
|
18
|
+
"vue": "2.6.12",
|
|
19
|
+
"vue-router": "3.0.2",
|
|
20
|
+
"vuex": "3.1.0",
|
|
21
|
+
"element-ui": "2.15.14"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@vue/cli-service": "5.0.9",
|
|
25
|
+
"@vue/cli-plugin-babel": "5.0.9",
|
|
26
|
+
"@babel/core": "^7.12.16",
|
|
27
|
+
"vue-template-compiler": "2.6.12",
|
|
28
|
+
"sass": "1.77.8",
|
|
29
|
+
"sass-loader": "12.6.0",
|
|
30
|
+
"svg-sprite-loader": "6.0.11",
|
|
31
|
+
"node-polyfill-webpack-plugin": "4.0.0"
|
|
32
|
+
},
|
|
33
|
+
"browserslist": ["> 1%", "last 2 versions", "not dead"]
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<noscript>请启用 JavaScript。</noscript>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 3h18v18H3zm2 2v4h14V5zm0 6v3h14v-3zm0 5v3h14v-3z"/></svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const identity = require("../app.config");
|
|
2
|
+
module.exports = {
|
|
3
|
+
MAIN_WEB_PREFIX: identity.mainWebPrefix,
|
|
4
|
+
WEB_PREFIX: "/" + identity.appCode,
|
|
5
|
+
USER_PREFIX: "/user", AGILEBPM_PREFIX: "/agilebpm",
|
|
6
|
+
MESSAGE_PREFIX: "/sf-cloud-message", BASE_FILEURL: "/user/common/fileurl",
|
|
7
|
+
BASIC_PREFIX: "/basic", CBASICS_PREFIX: "/cbasics",
|
|
8
|
+
YX_PREFIX: "/yx", TWS_PREFIX: "/tws", HWYX_PREFIX: "/hwyx",
|
|
9
|
+
FW_PREFIX: "/fw", HUB_PREFIX: "/hub", PMD_PREFIX: "/pmd",
|
|
10
|
+
SUPPORT_PREFIX: "/support", FINANCE_PREFIX: "/finance",
|
|
11
|
+
PCP_PREFIX: "/pcp", FSC_PREFIX: "/fsc", EC_PREFIX: "/ec",
|
|
12
|
+
BD_PREFIX: "/xbd", MMLG_PREFIX: "/mmlg"
|
|
13
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Application-owned branding required by Core's default login view.
|
|
2
|
+
.login-container {
|
|
3
|
+
min-height: 100vh;
|
|
4
|
+
background: url("~@/resources/images/bg-login5.jpg") center / cover no-repeat;
|
|
5
|
+
}
|
|
6
|
+
.login-main {
|
|
7
|
+
position: absolute;
|
|
8
|
+
right: 8%;
|
|
9
|
+
top: 50%;
|
|
10
|
+
transform: translateY(-50%);
|
|
11
|
+
width: 464px;
|
|
12
|
+
max-width: 90vw;
|
|
13
|
+
background: white;
|
|
14
|
+
border-radius: 8px;
|
|
15
|
+
box-shadow: 0 3px 22px #0002;
|
|
16
|
+
.box-form { padding: 32px; }
|
|
17
|
+
.txt { position: relative; }
|
|
18
|
+
.svg-container { display: none; }
|
|
19
|
+
.show-pwd { position: absolute; right: 12px; top: 0; cursor: pointer; }
|
|
20
|
+
.btn { width: 100%; margin-top: 20px; }
|
|
21
|
+
}
|
|
22
|
+
.copyright {
|
|
23
|
+
position: fixed;
|
|
24
|
+
bottom: 0;
|
|
25
|
+
width: 100%;
|
|
26
|
+
padding: 12px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
color: #666;
|
|
29
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const identity = require("../app.config");
|
|
2
|
+
module.exports = {
|
|
3
|
+
title: identity.title,
|
|
4
|
+
appCode: identity.appCode,
|
|
5
|
+
microMainEnabled: false,
|
|
6
|
+
i18nEnabled: true,
|
|
7
|
+
accessLogEnabled: false,
|
|
8
|
+
wfModel: 1,
|
|
9
|
+
defalutPrevMinX: 200,
|
|
10
|
+
defalutNextMinX: 550,
|
|
11
|
+
defalutPrevMinY: 180,
|
|
12
|
+
defalutNextMinY: 70,
|
|
13
|
+
defaultHomePage: "/demo/list.vue",
|
|
14
|
+
privateProfileCode: "private_profile",
|
|
15
|
+
uploadFileSize: 200,
|
|
16
|
+
base64Urls: [
|
|
17
|
+
"/user/common_script/save", "/user/common_script/update",
|
|
18
|
+
"/user/api_request/save", "/user/api_request/update",
|
|
19
|
+
"/user/export_template/save", "/user/export_template/update",
|
|
20
|
+
"/user/notify_template/save", "/user/notify_template/update",
|
|
21
|
+
"/user/push_setting/save", "/user/push_setting/update",
|
|
22
|
+
"/user/wf_diy_attribute/save", "/user/wf_diy_attribute/update"
|
|
23
|
+
]
|
|
24
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-form ref="form" :model="form" label-width="80px" @submit.native.prevent>
|
|
3
|
+
<el-form-item label="名称" prop="name" :rules="[{ required: true, whitespace: true, message: '请输入名称', trigger: 'blur' }]">
|
|
4
|
+
<el-input v-model="form.name" />
|
|
5
|
+
</el-form-item>
|
|
6
|
+
<el-form-item>
|
|
7
|
+
<el-button type="primary" @click="save">保存</el-button>
|
|
8
|
+
<el-button @click="$emit('close')">取消</el-button>
|
|
9
|
+
</el-form-item>
|
|
10
|
+
</el-form>
|
|
11
|
+
</template>
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: "ChildDemoDetail",
|
|
15
|
+
props: { record: { type: Object, default: () => ({ name: "" }) } },
|
|
16
|
+
data() { return { form: { ...this.record } }; },
|
|
17
|
+
methods: { save() { this.$refs.form.validate(valid => { if (valid) this.$emit("save", { ...this.form }); }); } }
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="child-demo">
|
|
3
|
+
<h2><svg-icon icon-class="child-demo" /> 子应用示例</h2>
|
|
4
|
+
<el-alert title="本页使用内存数据,刷新后恢复;未接入业务后端。" type="info" :closable="false" />
|
|
5
|
+
<div class="child-demo__toolbar">
|
|
6
|
+
<el-input v-model="query" placeholder="按名称筛选" clearable />
|
|
7
|
+
<el-button type="primary" @click="edit(null)">新增</el-button>
|
|
8
|
+
</div>
|
|
9
|
+
<el-table :data="filteredRows" row-key="id" border>
|
|
10
|
+
<el-table-column prop="id" label="编号" />
|
|
11
|
+
<el-table-column prop="name" label="名称" />
|
|
12
|
+
<el-table-column label="操作">
|
|
13
|
+
<template slot-scope="scope"><el-button type="text" @click="edit(scope.row)">编辑</el-button></template>
|
|
14
|
+
</el-table-column>
|
|
15
|
+
</el-table>
|
|
16
|
+
<el-dialog title="编辑示例" :visible.sync="visible" append-to-body destroy-on-close>
|
|
17
|
+
<detail v-if="visible" :record="selected" @save="save" @close="visible = false" />
|
|
18
|
+
</el-dialog>
|
|
19
|
+
</section>
|
|
20
|
+
</template>
|
|
21
|
+
<script>
|
|
22
|
+
import Detail from "./detail.vue";
|
|
23
|
+
export default {
|
|
24
|
+
name: "ChildDemoList",
|
|
25
|
+
components: { Detail },
|
|
26
|
+
data: () => ({ query: "", rows: [{ id: 1, name: "示例记录" }], selected: null, visible: false, nextId: 2 }),
|
|
27
|
+
computed: { filteredRows() { return this.rows.filter(row => row.name.includes(this.query)); } },
|
|
28
|
+
methods: {
|
|
29
|
+
edit(row) { this.selected = row ? { ...row } : { name: "" }; this.visible = true; },
|
|
30
|
+
save(record) {
|
|
31
|
+
const index = this.rows.findIndex(row => row.id === record.id);
|
|
32
|
+
if (index < 0) this.rows.push({ ...record, id: this.nextId++ });
|
|
33
|
+
else this.$set(this.rows, index, { ...record });
|
|
34
|
+
this.visible = false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Login from "@base/views/user/login/default.vue";
|
|
3
|
+
export default {
|
|
4
|
+
extends: Login,
|
|
5
|
+
methods: {
|
|
6
|
+
// Core's normal-login initializer redirects production children to MAIN_WEB_PREFIX.
|
|
7
|
+
// This standalone-capable template keeps the form here; authentication, SSO,
|
|
8
|
+
// validation and token handling still come from Core's Login component.
|
|
9
|
+
login() {
|
|
10
|
+
window.removeEventListener("keydown", this.keyDown, false);
|
|
11
|
+
window.addEventListener("keydown", this.keyDown, false);
|
|
12
|
+
this.changeBackground();
|
|
13
|
+
this.initPassword();
|
|
14
|
+
this.showView = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
|
|
3
|
+
const { ResourcesPlugin } = require("cloud-web-corejs/resource-tools");
|
|
4
|
+
const identity = require("./app.config");
|
|
5
|
+
const packageName = require("./package.json").name;
|
|
6
|
+
const coreSrc = path.dirname(require.resolve("cloud-web-corejs/src/index.next.js"));
|
|
7
|
+
const appSrc = path.resolve(__dirname, "src");
|
|
8
|
+
const coreIcons = path.join(coreSrc, "icons");
|
|
9
|
+
const appIcons = path.join(appSrc, "icons");
|
|
10
|
+
const base = "/" + identity.appCode;
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
publicPath: base + "/",
|
|
14
|
+
runtimeCompiler: true,
|
|
15
|
+
productionSourceMap: false,
|
|
16
|
+
transpileDependencies: ["cloud-web-corejs"],
|
|
17
|
+
devServer: {
|
|
18
|
+
port: 17527,
|
|
19
|
+
headers: { "Access-Control-Allow-Origin": "*" },
|
|
20
|
+
proxy: process.env.API_TARGET ? {
|
|
21
|
+
"/api": { target: process.env.API_TARGET, changeOrigin: true, pathRewrite: { "^/api": "" } }
|
|
22
|
+
} : {},
|
|
23
|
+
setupMiddlewares(middlewares) {
|
|
24
|
+
middlewares.unshift({
|
|
25
|
+
name: "child-root-alias",
|
|
26
|
+
middleware(req, res, next) {
|
|
27
|
+
const url = req.url || "/";
|
|
28
|
+
const pathname = url.split("?")[0];
|
|
29
|
+
const bypass = [base, "/api", "/ws", "/sockjs-node", "/webpack-dev-server", "/__webpack_dev_server__"];
|
|
30
|
+
if (!bypass.some(p => pathname === p || pathname.startsWith(p + "/"))) {
|
|
31
|
+
req.url = base + (url.startsWith("/") ? url : "/" + url);
|
|
32
|
+
}
|
|
33
|
+
next();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return middlewares;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
configureWebpack: {
|
|
40
|
+
// Core's development view context is synchronous. Keep source maps external
|
|
41
|
+
// so the browser does not download/parse a ~100 MB inline-map vendor script.
|
|
42
|
+
devtool: process.env.NODE_ENV === "development" ? "cheap-module-source-map" : false,
|
|
43
|
+
resolve: {
|
|
44
|
+
alias: {
|
|
45
|
+
"@": appSrc,
|
|
46
|
+
"@base": coreSrc,
|
|
47
|
+
// The app and the source package must use the same Vue constructor.
|
|
48
|
+
"vue$": require.resolve("vue/dist/vue.esm.js")
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
output: {
|
|
52
|
+
library: `${packageName}-[name]`,
|
|
53
|
+
libraryTarget: "umd",
|
|
54
|
+
chunkLoadingGlobal: `webpackJsonp_${packageName}`
|
|
55
|
+
},
|
|
56
|
+
plugins: [new NodePolyfillPlugin(), new ResourcesPlugin(__dirname)]
|
|
57
|
+
},
|
|
58
|
+
chainWebpack(config) {
|
|
59
|
+
config.plugin("html").tap(args => {
|
|
60
|
+
Object.assign(args[0], { title: identity.title, inject: "body", scriptLoading: "blocking" });
|
|
61
|
+
return args;
|
|
62
|
+
});
|
|
63
|
+
config.plugin("define").tap(args => {
|
|
64
|
+
const raw = JSON.stringify(process.env.VUE_APP_BASE_API || "");
|
|
65
|
+
args[0]["process.env"].VUE_APP_BASE_API =
|
|
66
|
+
`(window.__resolveApiBase__ ? window.__resolveApiBase__(${raw}) : ${raw})`;
|
|
67
|
+
return args;
|
|
68
|
+
});
|
|
69
|
+
config.plugins.delete("prefetch");
|
|
70
|
+
config.plugins.delete("preload");
|
|
71
|
+
// Core exposes many lazy pages. Parallel minimizers duplicate their large module
|
|
72
|
+
// graph in worker processes and can exhaust an 8 GB CI/container build host.
|
|
73
|
+
if (process.env.NODE_ENV === "production") {
|
|
74
|
+
config.optimization.minimizer("terser").tap(args => {
|
|
75
|
+
args[0].parallel = false;
|
|
76
|
+
return args;
|
|
77
|
+
});
|
|
78
|
+
config.optimization.minimizer("css").tap(args => {
|
|
79
|
+
args[0].parallel = false;
|
|
80
|
+
return args;
|
|
81
|
+
});
|
|
82
|
+
// Vue 2's loader imports a default from every SFC style block.
|
|
83
|
+
// Match that contract instead of emitting empty ES modules after extraction.
|
|
84
|
+
["css", "postcss", "scss", "sass", "less", "stylus"].forEach(type => {
|
|
85
|
+
config.module.rule(type).oneOfs.store.forEach(rule => {
|
|
86
|
+
if (rule.uses.has("extract-css-loader")) {
|
|
87
|
+
rule.use("extract-css-loader").tap(options => ({ ...options, esModule: false }));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// Preserve Core's :export { theme/menuBg/... } SCSS-to-JS values without
|
|
93
|
+
// renaming global classes. SFC module/scoped styles keep their own rules.
|
|
94
|
+
config.module.rule("scss").oneOf("normal").use("css-loader")
|
|
95
|
+
.tap(options => ({ ...options, modules: { mode: "icss" } }));
|
|
96
|
+
config.module.rule("svg").exclude.add(coreIcons).add(appIcons);
|
|
97
|
+
config.module.rule("icons").test(/\.svg$/)
|
|
98
|
+
.include.add(coreIcons).add(appIcons).end()
|
|
99
|
+
.use("svg-sprite-loader").loader("svg-sprite-loader")
|
|
100
|
+
.options({ symbolId: "icon-[name]" });
|
|
101
|
+
},
|
|
102
|
+
css: {
|
|
103
|
+
loaderOptions: {
|
|
104
|
+
sass: { additionalData: '@import "~@base/styles/theme-variables.scss";' }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|