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`; module.exports = { // 应用后端git地址,部署上线需要 javaGit: "", // 应用后端仓库名称,部署上线需要 javaGitName: "", // 环境配置 environment: { development: { // 应用后端分支名称,部署上线需要 javaGitBranch: "", // 接口服务地址 API_HOST: "https://gbs-gateway.qhdsafety.com", }, production: { // 应用后端分支名称,部署上线需要 javaGitBranch: "", // 接口服务地址 API_HOST: "", }, }, // 应用唯一标识符 appIdentifier, // 应用上下文注入全局变量 contextInject: { // 应用Key appKey: "", fileUrl: "", }, // public/index.html注入全局变量 windowInject: { // 应用标题 title: "微应用模板", // 注入css链接集合 links: [], element: { root: { // 挂载DOM元素ID id: "root", }, }, // 注入js链接集合 scripts: [], }, // 开发服务 server: { // 监听端口号 port: "8956", // 服务地址 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, }, 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}/`), }), ], }, };