2026-08-21 15:03:50 +08:00
|
|
|
|
const path = require("node:path");
|
|
|
|
|
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
|
|
|
|
const webpack = require("webpack");
|
|
|
|
|
|
|
|
|
|
|
|
const cesiumBuildPath = path.join(
|
|
|
|
|
|
path.dirname(require.resolve("cesium/package.json")),
|
|
|
|
|
|
"Build/Cesium",
|
|
|
|
|
|
);
|
|
|
|
|
|
const appIdentifier = "bi-h5";
|
|
|
|
|
|
const cesiumStaticPath = `${appIdentifier}/static/cesium`;
|
|
|
|
|
|
|
2025-12-18 14:48:37 +08:00
|
|
|
|
module.exports = {
|
|
|
|
|
|
// 应用后端git地址,部署上线需要
|
|
|
|
|
|
javaGit: "<git-url>",
|
|
|
|
|
|
// 应用后端仓库名称,部署上线需要
|
|
|
|
|
|
javaGitName: "<git-name>",
|
|
|
|
|
|
// 环境配置
|
|
|
|
|
|
environment: {
|
|
|
|
|
|
development: {
|
|
|
|
|
|
// 应用后端分支名称,部署上线需要
|
|
|
|
|
|
javaGitBranch: "<branch-name>",
|
|
|
|
|
|
// 接口服务地址
|
2026-08-24 10:41:29 +08:00
|
|
|
|
API_HOST: "https://gbs-gateway.qhdsafety.com",
|
2025-12-18 14:48:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
production: {
|
|
|
|
|
|
// 应用后端分支名称,部署上线需要
|
|
|
|
|
|
javaGitBranch: "<branch-name>",
|
|
|
|
|
|
// 接口服务地址
|
2026-07-17 17:35:09 +08:00
|
|
|
|
API_HOST: "",
|
2025-12-18 14:48:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
// 应用唯一标识符
|
2026-08-21 15:03:50 +08:00
|
|
|
|
appIdentifier,
|
2025-12-18 14:48:37 +08:00
|
|
|
|
// 应用上下文注入全局变量
|
|
|
|
|
|
contextInject: {
|
|
|
|
|
|
// 应用Key
|
|
|
|
|
|
appKey: "",
|
2026-07-20 14:23:04 +08:00
|
|
|
|
fileUrl: "",
|
2025-12-18 14:48:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
// public/index.html注入全局变量
|
|
|
|
|
|
windowInject: {
|
|
|
|
|
|
// 应用标题
|
|
|
|
|
|
title: "微应用模板",
|
|
|
|
|
|
// 注入css链接集合
|
|
|
|
|
|
links: [],
|
|
|
|
|
|
element: {
|
|
|
|
|
|
root: {
|
|
|
|
|
|
// 挂载DOM元素ID
|
|
|
|
|
|
id: "root",
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
// 注入js链接集合
|
|
|
|
|
|
scripts: [],
|
|
|
|
|
|
},
|
|
|
|
|
|
// 开发服务
|
|
|
|
|
|
server: {
|
|
|
|
|
|
// 监听端口号
|
2026-07-20 14:23:04 +08:00
|
|
|
|
port: "8956",
|
2025-12-18 14:48:37 +08:00
|
|
|
|
// 服务地址
|
|
|
|
|
|
host: "127.0.0.1",
|
|
|
|
|
|
// 是否自动打开浏览器
|
|
|
|
|
|
open: true,
|
|
|
|
|
|
},
|
|
|
|
|
|
// 框架
|
|
|
|
|
|
framework: {
|
|
|
|
|
|
// ant-design
|
|
|
|
|
|
antd: {
|
|
|
|
|
|
// 全局antd-class-name前缀
|
|
|
|
|
|
"ant-prefix": "micro-temp",
|
|
|
|
|
|
// 全局字体
|
|
|
|
|
|
"fontFamily": "PingFangSC-Regular",
|
|
|
|
|
|
// 全局主题色
|
|
|
|
|
|
"colorPrimary": "#1677ff",
|
|
|
|
|
|
// 全局圆角
|
|
|
|
|
|
"borderRadius": 2,
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
// webpack
|
|
|
|
|
|
webpackConfig: {
|
|
|
|
|
|
// 单页面插件
|
|
|
|
|
|
htmlWebpackPluginOption: {
|
|
|
|
|
|
// 自动注入编译后的文件到public/index.html中
|
|
|
|
|
|
inject: true,
|
|
|
|
|
|
},
|
2026-08-21 15:03:50 +08:00
|
|
|
|
plugins: [
|
|
|
|
|
|
new CopyWebpackPlugin({
|
|
|
|
|
|
patterns: ["Assets", "ThirdParty", "Widgets", "Workers"].map(name => ({
|
|
|
|
|
|
from: path.join(cesiumBuildPath, name),
|
|
|
|
|
|
to: `${cesiumStaticPath}/${name}`,
|
|
|
|
|
|
})),
|
|
|
|
|
|
}),
|
|
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
|
|
CESIUM_BASE_URL: JSON.stringify(`/${cesiumStaticPath}/`),
|
|
|
|
|
|
}),
|
|
|
|
|
|
],
|
2025-12-18 14:48:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
};
|