forked from github/dataease
chore(X-Pack): 默认以分离式xpack前端模式运行
This commit is contained in:
parent
4dd1408794
commit
be6979da57
3
core/core-frontend/.env.distributed
Normal file
3
core/core-frontend/.env.distributed
Normal file
@ -0,0 +1,3 @@
|
||||
# 接口前缀
|
||||
VITE_API_BASEPATH="./de2api"
|
||||
VITE_VERSION="0.0.0"
|
32
core/core-frontend/config/distributed.ts
Normal file
32
core/core-frontend/config/distributed.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import pkg from '../package.json'
|
||||
import viteCompression from 'vite-plugin-compression'
|
||||
|
||||
export default {
|
||||
plugins: [
|
||||
viteCompression({
|
||||
// gzip静态资源压缩配置
|
||||
verbose: true, // 是否在控制台输出压缩结果
|
||||
disable: false, // 是否禁用压缩
|
||||
threshold: 10240, // 启用压缩的文件大小限制
|
||||
algorithm: 'gzip', // 采用的压缩算法
|
||||
ext: '.gz' // 生成的压缩包后缀
|
||||
})
|
||||
],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
external: id => /de-xpack/.test(id),
|
||||
output: {
|
||||
// 用于命名代码拆分时创建的共享块的输出命名
|
||||
chunkFileNames: `assets/chunk/[name]-${pkg.version}-${pkg.name}.js`,
|
||||
assetFileNames: `assets/[ext]/[name]-${pkg.version}-${pkg.name}.[ext]`,
|
||||
entryFileNames: `js/[name]-${pkg.version}-${pkg.name}.js`,
|
||||
manualChunks(id: string) {
|
||||
if (id.includes('node_modules')) {
|
||||
return id.toString().split('node_modules/')[1].split('/')[0].toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
sourcemap: false
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@
|
||||
"build:flush": "cd ./flushbonading && rimraf ./demo.html && npm i && node ./index.js",
|
||||
"ts:check": "vue-tsc --noEmit",
|
||||
"build:base": "NODE_OPTIONS=--max_old_space_size=4096 vite build --mode base && npm run build:flush",
|
||||
"build:distributed": "NODE_OPTIONS=--max_old_space_size=4096 vite build --mode distributed && npm run build:flush",
|
||||
"build:lib": "vite build --mode lib",
|
||||
"lint": "eslint . --ext .vue,.js,.ts,.jsx,.tsx --fix",
|
||||
"lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
|
||||
|
@ -74,7 +74,7 @@
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>run build:base</arguments>
|
||||
<arguments>run build:distributed</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
@ -1,5 +1,6 @@
|
||||
import common from './config/common';
|
||||
import base from './config/base';
|
||||
import distributed from './config/distributed';
|
||||
import dev from './config/dev';
|
||||
import lib from './config/lib';
|
||||
import pages from './config/pages';
|
||||
@ -13,6 +14,9 @@ export default defineConfig(({mode}) => {
|
||||
if (mode === 'lib') {
|
||||
return mergeConfig(common , lib)
|
||||
}
|
||||
if (mode === 'distributed') {
|
||||
return mergeConfig(common, mergeConfig(distributed, pages))
|
||||
}
|
||||
|
||||
return mergeConfig(common, mergeConfig(base, pages))
|
||||
})
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit 68a6c1ae726d0523843666edf1490c3857492235
|
||||
Subproject commit 44b16d7cfc1d05167aeecad51767da723af45abd
|
Loading…
Reference in New Issue
Block a user