增加轻量启动模式,只加载相关项目的代码,来减少构建,启动,刷新,调试所需要的时间
This commit is contained in:
@@ -44,7 +44,7 @@ export default {
|
|||||||
let reg = new RegExp(`.*${this.searchApp?.replace(/-/g,'')||''}.*`, 'gi')
|
let reg = new RegExp(`.*${this.searchApp?.replace(/-/g,'')||''}.*`, 'gi')
|
||||||
return (this.apps || []).filter(e => !this.searchApp || reg?.test(e.name) || reg?.test(e.label)).map(e => {
|
return (this.apps || []).filter(e => !this.searchApp || reg?.test(e.name) || reg?.test(e.label)).map(e => {
|
||||||
if (/\/project\//.test(e.path)) {
|
if (/\/project\//.test(e.path)) {
|
||||||
e.project = e.path.replace(/.*project\/([^\/]+)\/.+/, '$1')
|
e.project = process.env.VUE_APP_SCOPE || e.path.replace(/.*project\/([^\/]+)\/.+/, '$1')
|
||||||
} else if (/\/core\//.test(e.path)) {
|
} else if (/\/core\//.test(e.path)) {
|
||||||
e.project = "core"
|
e.project = "core"
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep( .ai-menu ){
|
:deep( .ai-menu ) {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
@@ -214,7 +214,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep( .searchApp ){
|
:deep( .searchApp ) {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import store from "../store";
|
|||||||
import {waiting} from "../utils";
|
import {waiting} from "../utils";
|
||||||
import appEntry from "../views/appEntry";
|
import appEntry from "../views/appEntry";
|
||||||
import router from "./router";
|
import router from "./router";
|
||||||
// import mods from "../modules"
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
routes: () => store.state.apps,
|
routes: () => store.state.apps,
|
||||||
@@ -11,16 +10,26 @@ export default {
|
|||||||
store.commit("cleanApps")
|
store.commit("cleanApps")
|
||||||
// 自动化本工程应用
|
// 自动化本工程应用
|
||||||
waiting.init({innerHTML: '应用加载中..'})
|
waiting.init({innerHTML: '应用加载中..'})
|
||||||
this.esm = {
|
let startTime = new Date().getTime()
|
||||||
all: {
|
switch (process.env.VUE_APP_SCOPE) {
|
||||||
packages: require.context('../../packages/', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy'),
|
case 'dv':
|
||||||
project: require.context('../../project/', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
this.esm = {
|
||||||
},
|
packages: require.context('../../packages/bigscreen', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
||||||
dv: {
|
}
|
||||||
packages: require.context('../../packages/bigscreen', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
break
|
||||||
}
|
case 'fengdu':
|
||||||
}[process.env.VUE_APP_SCOPE || "all"]
|
this.esm = {
|
||||||
const startTime = new Date().getTime()
|
project: require.context('../../project/fengdu', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
this.esm = {
|
||||||
|
packages: require.context('../../packages/', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy'),
|
||||||
|
project: require.context('../../project/', true, /\.(\/.+)\/App[A-Z][^\/]+\.vue$/, 'lazy')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('模块引用用了%s秒', (new Date().getTime() - startTime) / 1000)
|
||||||
|
startTime = new Date().getTime()
|
||||||
this.loadApps().finally(() => {
|
this.loadApps().finally(() => {
|
||||||
console.log('模块加载用了%s秒', (new Date().getTime() - startTime) / 1000)
|
console.log('模块加载用了%s秒', (new Date().getTime() - startTime) / 1000)
|
||||||
waiting.close()
|
waiting.close()
|
||||||
@@ -53,6 +62,6 @@ export default {
|
|||||||
return store.commit("addApp", addApp)
|
return store.commit("addApp", addApp)
|
||||||
} else return 0
|
} else return 0
|
||||||
}).catch(err => console.log(err))))
|
}).catch(err => console.log(err))))
|
||||||
return Promise.all(Object.entries(this.esm).map(([root, mods]) => promise(mods, root)))
|
return Promise.all(Object.entries(this.esm).map(([root, mods]) => promise(mods, root))).catch(console.error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "vue-cli-service serve",
|
||||||
"dev:dv": "set VUE_APP_SCOPE=dv&&vue-cli-service serve",
|
"dev:dv": "set VUE_APP_SCOPE=dv&&vue-cli-service serve",
|
||||||
|
"dev:fengdu": "set VUE_APP_SCOPE=fengdu&&vue-cli-service serve",
|
||||||
"lib": "npm unpublish --force&&npm publish",
|
"lib": "npm unpublish --force&&npm publish",
|
||||||
"ui": "npm run lib -w ui&&npm i dui@latest",
|
"ui": "npm run lib -w ui&&npm i dui@latest",
|
||||||
"sync": "node bin/appsSync.js"
|
"sync": "node bin/appsSync.js"
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const proxy = {
|
||||||
|
dv: "https://pingchangdjweb.icunwei.com/",
|
||||||
|
fengdu: "https://web.fdfengshou.cn/"
|
||||||
|
}[process.env.VUE_APP_SCOPE] || "http://192.168.1.87:9000"
|
||||||
module.exports = {
|
module.exports = {
|
||||||
lintOnSave: false,
|
lintOnSave: false,
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
@@ -17,90 +21,33 @@ module.exports = {
|
|||||||
filename: 'index.html'
|
filename: 'index.html'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
transpileDependencies: [/dui[\\\/]lib[\\\/]js/],
|
transpileDependencies: [/dui[\\\/]lib[\\\/]js/, /manifest.js/],
|
||||||
chainWebpack: (config) => {
|
chainWebpack: (config) => {
|
||||||
config.module
|
config.module
|
||||||
.rule('js')
|
.rule('js')
|
||||||
.include
|
.include
|
||||||
.add(path.resolve(__dirname, 'packages'))
|
.add(path.resolve(__dirname, 'packages'))
|
||||||
.add(path.resolve(__dirname, 'components'))
|
.add(path.resolve(__dirname, 'components'))
|
||||||
.add(path.resolve(__dirname, 'project'))
|
.add(path.resolve(__dirname, 'project'))
|
||||||
.add(path.resolve(__dirname, 'examples'))
|
.add(path.resolve(__dirname, 'examples'))
|
||||||
.add(path.resolve(__dirname, 'ui'))
|
.add(path.resolve(__dirname, 'ui'))
|
||||||
.end().use('babel').loader('babel-loader').tap(options => options);
|
.end().use('babel').loader('babel-loader').tap(options => options);
|
||||||
config.plugin("limit").use(require("webpack/lib/optimize/LimitChunkCountPlugin"), [{maxChunks: 10}]).tap(options => options)
|
config.plugin("limit").use(require("webpack/lib/optimize/LimitChunkCountPlugin"), [{maxChunks: 10}]).tap(options => options)
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
host: '0.0.0.0', //主机地址
|
host: '0.0.0.0', //主机地址
|
||||||
port: 80, //端口号
|
port: 80, //端口号
|
||||||
open: true,
|
open: true,
|
||||||
// devtool: 'cheap-module-eval-source-map',
|
|
||||||
proxy: {
|
proxy: {
|
||||||
//设置代理,可解决跨5
|
//设置代理,可解决跨
|
||||||
'/lan': {
|
'/lan': {
|
||||||
target: 'http://192.168.1.87:9000',
|
target: proxy,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
//地址重写
|
//地址重写
|
||||||
'^/lan': '/'
|
'^/lan': '/'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'/analysis': {
|
|
||||||
target: 'http://192.168.1.87:22001',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {
|
|
||||||
//地址重写
|
|
||||||
'^/analysis': '/'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'/saas': {
|
|
||||||
target: 'http://192.168.1.34:19898',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {
|
|
||||||
//地址重写
|
|
||||||
'^/saas': '/'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'/omsapi': {
|
|
||||||
target: 'http://192.168.1.87:19897',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {
|
|
||||||
//地址重写
|
|
||||||
'^/omsapi': '/'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'/ns': {
|
|
||||||
target: 'http://192.168.1.87:12525',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {
|
|
||||||
//地址重写
|
|
||||||
'^/ns': '/'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'/lns': {
|
|
||||||
target: 'http://localhost:12525',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {
|
|
||||||
//地址重写
|
|
||||||
'^/lns': '/'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'/tfx': {
|
|
||||||
target: 'http://192.168.1.87:59998',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {
|
|
||||||
//地址重写
|
|
||||||
'^/tfx': '/'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'/map': {
|
|
||||||
target: 'https://geo.datav.aliyun.com',
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {
|
|
||||||
//地址重写
|
|
||||||
'^/map': '/'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
disableHostCheck: true,
|
disableHostCheck: true,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user