|
@@ -7,7 +7,8 @@ function resolve(dir) {
|
|
|
return path.join(__dirname, dir);
|
|
return path.join(__dirname, dir);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const publicPath = process.env.VUE_APP_PUBLIC_PATH || "/page-hr/";
|
|
|
|
|
|
|
+// 与 EOM(/eos)、WT(/wt) 一致:静态资源部署在短路径 /hr,乾坤路由前缀才是 /page-hr
|
|
|
|
|
+const publicPath = process.env.VUE_APP_PUBLIC_PATH || "/hr";
|
|
|
|
|
|
|
|
// element-ui / ele-admin 仍使用 Sass @import,静音 Dart Sass 弃用警告
|
|
// element-ui / ele-admin 仍使用 Sass @import,静音 Dart Sass 弃用警告
|
|
|
const sassOptions = {
|
|
const sassOptions = {
|
|
@@ -34,12 +35,12 @@ module.exports = {
|
|
|
maxEntrypointSize: 2000000,
|
|
maxEntrypointSize: 2000000,
|
|
|
},
|
|
},
|
|
|
output: {
|
|
output: {
|
|
|
- // qiankun 子应用:打包成 umd,并避免全局对象在严格模式下异常
|
|
|
|
|
- library: `${name}-[name]`,
|
|
|
|
|
- libraryTarget: "umd",
|
|
|
|
|
|
|
+ // 与 EOM/WT 一致:子应用打包成 umd 库格式
|
|
|
|
|
+ library: {
|
|
|
|
|
+ type: "umd",
|
|
|
|
|
+ name: `${name}`,
|
|
|
|
|
+ },
|
|
|
chunkLoadingGlobal: `webpackJsonp_${name}`,
|
|
chunkLoadingGlobal: `webpackJsonp_${name}`,
|
|
|
- globalObject: "window",
|
|
|
|
|
- uniqueName: name,
|
|
|
|
|
},
|
|
},
|
|
|
// Vue2 + vue-style-loader:样式靠副作用注入,不导出 default;
|
|
// Vue2 + vue-style-loader:样式靠副作用注入,不导出 default;
|
|
|
// Webpack5 会对 `import style0 from ...` 报 missing export,可安全忽略
|
|
// Webpack5 会对 `import style0 from ...` 报 missing export,可安全忽略
|
|
@@ -52,23 +53,29 @@ module.exports = {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
devServer: {
|
|
devServer: {
|
|
|
- open: [publicPath],
|
|
|
|
|
|
|
+ open: [publicPath.endsWith("/") ? publicPath : `${publicPath}/`],
|
|
|
historyApiFallback: {
|
|
historyApiFallback: {
|
|
|
- index: path.posix.join(publicPath, "index.html"),
|
|
|
|
|
|
|
+ index: path.posix.join(
|
|
|
|
|
+ publicPath.endsWith("/") ? publicPath : `${publicPath}/`,
|
|
|
|
|
+ "index.html",
|
|
|
|
|
+ ),
|
|
|
},
|
|
},
|
|
|
setupMiddlewares(middlewares) {
|
|
setupMiddlewares(middlewares) {
|
|
|
middlewares.unshift({
|
|
middlewares.unshift({
|
|
|
name: "redirect-to-app",
|
|
name: "redirect-to-app",
|
|
|
middleware(req, res, next) {
|
|
middleware(req, res, next) {
|
|
|
const url = (req.url || "").split("?")[0];
|
|
const url = (req.url || "").split("?")[0];
|
|
|
|
|
+ const appIndex = publicPath.endsWith("/")
|
|
|
|
|
+ ? publicPath
|
|
|
|
|
+ : `${publicPath}/`;
|
|
|
if (
|
|
if (
|
|
|
url === "/" ||
|
|
url === "/" ||
|
|
|
- url === "/hr" ||
|
|
|
|
|
- url === "/hr/" ||
|
|
|
|
|
|
|
+ url === "/page-hr" ||
|
|
|
|
|
+ url === "/page-hr/" ||
|
|
|
url === "/hr-pc" ||
|
|
url === "/hr-pc" ||
|
|
|
url === "/hr-pc/"
|
|
url === "/hr-pc/"
|
|
|
) {
|
|
) {
|
|
|
- res.redirect(publicPath);
|
|
|
|
|
|
|
+ res.redirect(appIndex);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
next();
|
|
next();
|
|
@@ -76,53 +83,26 @@ module.exports = {
|
|
|
});
|
|
});
|
|
|
return middlewares;
|
|
return middlewares;
|
|
|
},
|
|
},
|
|
|
- // 代理跨域的配置
|
|
|
|
|
proxy: {
|
|
proxy: {
|
|
|
- // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
|
|
|
|
|
"/api": {
|
|
"/api": {
|
|
|
- // target: 'http://192.168.1.3:18086',
|
|
|
|
|
- // target: 'http://192.168.1.158:18086',
|
|
|
|
|
- // target: 'http://192.168.1.176:18086',
|
|
|
|
|
- // target: "http://192.168.1.125:18086",
|
|
|
|
|
- // target: 'http://192.168.1.251:51005',
|
|
|
|
|
- // target: 'http://192.168.1.251:18186',
|
|
|
|
|
- // target: 'http://192.168.1.251:18086', // 服务器
|
|
|
|
|
- // target: 'http://192.168.1.251:18186',
|
|
|
|
|
- // target: 'http://192.168.1.3:18086',
|
|
|
|
|
- // target: 'http://192.168.1.251:18186', // 测试环境
|
|
|
|
|
- // target: 'http://192.168.1.251:18087',
|
|
|
|
|
- // target: 'http://192.168.1.116:18086',
|
|
|
|
|
- // target: 'http://192.168.1.125:18086',
|
|
|
|
|
- // target: 'http://192.168.1.11:18086', // 开发
|
|
|
|
|
- // target: 'http://192.168.1.116:18086', // 赵沙金
|
|
|
|
|
- // target: 'http://aiot.zoomwin.com.cn:51001/api',
|
|
|
|
|
- // target: 'http://f222326r53.imwork.net',
|
|
|
|
|
- // target: 'http://aiot.zoomwin.com.cn:51005/api',
|
|
|
|
|
target: "http://192.168.1.147:18086",
|
|
target: "http://192.168.1.147:18086",
|
|
|
- changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
|
|
|
|
|
|
|
+ changeOrigin: true,
|
|
|
pathRewrite: {
|
|
pathRewrite: {
|
|
|
"^/api": "",
|
|
"^/api": "",
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
- // kkFileView 在线预览(与 WT 一致,本地才能打开 /kkfile/onlinePreview)
|
|
|
|
|
"/kkfile": {
|
|
"/kkfile": {
|
|
|
target: "http://aiot.zoomwin.com.cn:51001",
|
|
target: "http://aiot.zoomwin.com.cn:51001",
|
|
|
changeOrigin: true,
|
|
changeOrigin: true,
|
|
|
pathRewrite: { "^/kkfile": "/kkfile" },
|
|
pathRewrite: { "^/kkfile": "/kkfile" },
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
headers: {
|
|
headers: {
|
|
|
"Access-Control-Allow-Origin": "*",
|
|
"Access-Control-Allow-Origin": "*",
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
chainWebpack(config) {
|
|
chainWebpack(config) {
|
|
|
config.plugins.delete("prefetch");
|
|
config.plugins.delete("prefetch");
|
|
|
- // qiankun:入口 js 需落在 body,避免 head+defer 导致生命周期读取失败
|
|
|
|
|
- config.plugin("html").tap((args) => {
|
|
|
|
|
- args[0].inject = "body";
|
|
|
|
|
- return args;
|
|
|
|
|
- });
|
|
|
|
|
config.module.rule("svg").exclude.add(resolve("src/icons")).end();
|
|
config.module.rule("svg").exclude.add(resolve("src/icons")).end();
|
|
|
config.module
|
|
config.module
|
|
|
.rule("icons")
|
|
.rule("icons")
|
|
@@ -137,7 +117,6 @@ module.exports = {
|
|
|
.end();
|
|
.end();
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV !== "development") {
|
|
if (process.env.NODE_ENV !== "development") {
|
|
|
- // gzip 压缩
|
|
|
|
|
config.plugin("compressionPlugin").use(
|
|
config.plugin("compressionPlugin").use(
|
|
|
new CompressionWebpackPlugin({
|
|
new CompressionWebpackPlugin({
|
|
|
test: /\.(js|css|html)$/,
|
|
test: /\.(js|css|html)$/,
|
|
@@ -148,7 +127,6 @@ module.exports = {
|
|
|
},
|
|
},
|
|
|
css: {
|
|
css: {
|
|
|
loaderOptions: {
|
|
loaderOptions: {
|
|
|
- // 与 vue-style-loader 的 CommonJS 约定对齐
|
|
|
|
|
css: {
|
|
css: {
|
|
|
esModule: false,
|
|
esModule: false,
|
|
|
},
|
|
},
|