按官方 jnpf-web-apps-main 默认模式 (../workspace/jnpf/jnpf-web-apps-main) 把门户页 从静态 HTML 升级为正常 Vue 组件 + 走 coreRoutes + ignoreAccess 双保险免登录。 变更: 1. jweb/src/views/ssw/views/_portal/tds.vue 新增(git add -f),884 行 HTML/CSS/JS 转 Vue SFC 2. jweb/src/router/routes/core.ts 加 SswPortalTds 路由 /ssw-portal/tds (coreRouteNames 直通,ignoreAccess:true 双保险) 3. jweb/vite.config.mts 删 ssw-portal-bypass-html-plugin 中间件(Accept:text/html SPA fallback 不再触发) 4. web/vite.config.ts 删 ssw-portal-dir-rewrite 中间件,改 fs.allow 指 jweb/src (公共 views 是软链) 5. jweb/public/ssw-tds/index.html 删除(彻底告别 public/ 静态门户页方案) 6. web/public/ssw-tds 软链删除 附带 sswflow 路由 namespace 修复(/flow + /projects 等统一为 /flow/editor + /flow/projects): - Home.vue / FlowEditor.vue / ProjectList.vue / RunHall.vue
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
import path from 'node:path'
|
|
|
|
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
|
// jweb 真源 src/views/ssw 是软链指向这里,需让 vite 放开 fs 限制(视图组件也走了这一处)
|
|
const jwebSrc = path.resolve(__dirname, '../jweb/apps/jnpf-web-apps-main/src')
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
// 三个子系统按目录隔离后层级变深,统一走 @ 别名,避免满屏 ../../../
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
server: {
|
|
host: true,
|
|
port: 5173,
|
|
// src/views/ssw 是软链到 jweb 的目录(跨项目符号链接),放开 fs 限制让 vite 能读
|
|
fs: {
|
|
allow: ['..', jwebSrc]
|
|
},
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:30000',
|
|
changeOrigin: true
|
|
}
|
|
}
|
|
},
|
|
plugins: [
|
|
vue(),
|
|
],
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
// 子系统各自成块,按需加载,互不牵连
|
|
manualChunks(id: string) {
|
|
if (id.includes('node_modules')) return 'vendor'
|
|
if (id.includes('/views/ssw/tds/')) return 'tds'
|
|
if (id.includes('/views/ssw/tdc/')) return 'tdc'
|
|
if (id.includes('/views/ssw/sswflow/')) return 'sswflow'
|
|
return undefined
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|