fix(build): 为构建资源添加发布版本标识
This commit is contained in:
@@ -89,14 +89,16 @@ medical-sign/
|
||||
|
||||
## 构建与部署规划
|
||||
|
||||
两个应用分别构建为 ```dist```:
|
||||
两个应用分别构建为 `dist`:
|
||||
|
||||
```text
|
||||
clinical-web/dist/ → 医护端网页
|
||||
patient-h5/dist/ → 患者手机签署网页
|
||||
```
|
||||
|
||||
```packages``` 中被使用的代码会在构建时打包进对应应用。生产环境不需要部署 ```node_modules``` 或 ```packages``` 源码。
|
||||
`packages` 中被使用的代码会在构建时打包进对应应用。生产环境不需要部署 `node_modules` 或 `packages` 源码。
|
||||
|
||||
两个应用的构建资源名都会包含构建 ID 和内容哈希。构建 ID 默认使用当前毫秒时间戳,确保连续发布不会复用同名 JS/CSS;CI 可通过 `BUILD_ID`(例如流水线编号或提交短 SHA)显式指定。生产 Nginx 应对 `index.html` 使用 `Cache-Control: no-cache`,对带构建 ID 的 `/assets/` 文件使用长期缓存。
|
||||
|
||||
医护端通常部署在医院内网;患者 H5 如果需要院外访问,应通过医院安全网关、DMZ 或反向代理提供服务。
|
||||
|
||||
|
||||
+31
-13
@@ -3,21 +3,39 @@ import { fileURLToPath, URL } from 'node:url'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
function resolveBuildId() {
|
||||
const configured = process.env.BUILD_ID?.trim().replace(/[^a-zA-Z0-9_-]/g, '')
|
||||
return configured || Date.now().toString(36)
|
||||
}
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://ipad.shenynet.com',
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
export default defineConfig(() => {
|
||||
const buildId = resolveBuildId()
|
||||
|
||||
return {
|
||||
plugins: [vue()],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
entryFileNames: `assets/[name]-${buildId}-[hash].js`,
|
||||
chunkFileNames: `assets/[name]-${buildId}-[hash].js`,
|
||||
assetFileNames: `assets/[name]-${buildId}-[hash][extname]`,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://ipad.shenynet.com',
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
+31
-13
@@ -3,21 +3,39 @@ import { fileURLToPath, URL } from 'node:url'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from 'vite'
|
||||
|
||||
function resolveBuildId() {
|
||||
const configured = process.env.BUILD_ID?.trim().replace(/[^a-zA-Z0-9_-]/g, '')
|
||||
return configured || Date.now().toString(36)
|
||||
}
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://ipad.shenynet.com',
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
export default defineConfig(() => {
|
||||
const buildId = resolveBuildId()
|
||||
|
||||
return {
|
||||
plugins: [vue()],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
entryFileNames: `assets/[name]-${buildId}-[hash].js`,
|
||||
chunkFileNames: `assets/[name]-${buildId}-[hash].js`,
|
||||
assetFileNames: `assets/[name]-${buildId}-[hash][extname]`,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://ipad.shenynet.com',
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user