c086d402a7
- brand/image 本地执行 API 服务端化(主机A shufu-web-api:15126,nginx 转发 /api/brand/* 等) - 前端撤销本地回连逻辑(local-http 删除,http.ts/brand.ts 还原为域名相对路径) - 版本更新改桌面桥 do_update_app(原 Flask /api/update/do 桥化,Web 无更新入口) - 品牌检测页 Web 可用(hasBridge 恢复 blanket 判定:文件选择走浏览器降级、任务/SSE 走域名) - vite 入口文件带内容 hash(/assets 配了 immutable 长缓存,无 hash 入口导致更新永不生效) - public/logo.jpg:Web 版 /logo.jpg 素材(原 app_client/logo.jpg 随桌面瘦身移除)
89 lines
3.3 KiB
TypeScript
89 lines
3.3 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
||
import { resolve } from 'node:path'
|
||
import { defineConfig } from 'vite'
|
||
import vue from '@vitejs/plugin-vue'
|
||
import AutoImport from 'unplugin-auto-import/vite'
|
||
import Components from 'unplugin-vue-components/vite'
|
||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||
|
||
export default defineConfig({
|
||
base: '/',
|
||
plugins: [
|
||
vue(),
|
||
AutoImport({
|
||
imports: ['vue', 'vue-router'],
|
||
resolvers: [ElementPlusResolver()],
|
||
dts: 'auto-imports.d.ts',
|
||
vueTemplate: true,
|
||
}),
|
||
Components({
|
||
resolvers: [ElementPlusResolver()],
|
||
dts: 'components.d.ts',
|
||
}),
|
||
],
|
||
resolve: {
|
||
alias: {
|
||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||
},
|
||
},
|
||
server: {
|
||
port: 5173,
|
||
proxy: {
|
||
'/newApi/api': {
|
||
target: process.env.VITE_API_TARGET || 'http://127.0.0.1:18080/',
|
||
changeOrigin: true,
|
||
rewrite: (path) => path.replace(/^\/newApi/, ''),
|
||
},
|
||
// /login、/check_login、/logout 等无 /api 前缀的 Java 接口(登录/用户信息)
|
||
'/newApi/login': {
|
||
target: process.env.VITE_API_TARGET || 'http://127.0.0.1:18080/',
|
||
changeOrigin: true,
|
||
rewrite: (path) => path.replace(/^\/newApi/, ''),
|
||
},
|
||
'/newApi/check_login': {
|
||
target: process.env.VITE_API_TARGET || 'http://127.0.0.1:18080/',
|
||
changeOrigin: true,
|
||
rewrite: (path) => path.replace(/^\/newApi/, ''),
|
||
},
|
||
},
|
||
},
|
||
build: {
|
||
outDir: 'new_web_source',
|
||
emptyOutDir: true,
|
||
cssCodeSplit: true,
|
||
rollupOptions: {
|
||
input: {
|
||
publish: resolve(__dirname, 'publish.html'),
|
||
dedupe: resolve(__dirname, 'dedupe.html'),
|
||
convert: resolve(__dirname, 'convert.html'),
|
||
split: resolve(__dirname, 'split.html'),
|
||
'delete-brand': resolve(__dirname, 'delete-brand.html'),
|
||
'appearance-patent': resolve(__dirname, 'appearance-patent.html'),
|
||
'similar-asin': resolve(__dirname, 'similar-asin.html'),
|
||
'product-risk': resolve(__dirname, 'product-risk.html'),
|
||
'shop-match': resolve(__dirname, 'shop-match.html'),
|
||
'price-track': resolve(__dirname, 'price-track.html'),
|
||
'patrol-delete': resolve(__dirname, 'patrol-delete.html'),
|
||
'query-asin': resolve(__dirname, 'query-asin.html'),
|
||
'shop-data-crawl': resolve(__dirname, 'shop-data-crawl.html'),
|
||
withdraw: resolve(__dirname, 'withdraw.html'),
|
||
'collect-data': resolve(__dirname, 'collect-data.html'),
|
||
'variant-collection': resolve(__dirname, 'variant-collection.html'),
|
||
brand: resolve(__dirname, 'brand.html'),
|
||
'image-video': resolve(__dirname, 'image-video.html'),
|
||
image: resolve(__dirname, 'image.html'),
|
||
'amazon-console': resolve(__dirname, 'amazon-console.html'),
|
||
home: resolve(__dirname, 'home.html'),
|
||
login: resolve(__dirname, 'login.html'),
|
||
},
|
||
output: {
|
||
// 入口文件同样带内容 hash:/assets/ 静态服务配了 immutable 长缓存,
|
||
// 无 hash 的入口文件会导致前端更新对用户永不生效(旧文件名被永久缓存)
|
||
entryFileNames: 'assets/[name]-[hash].js',
|
||
chunkFileNames: 'assets/[name]-[hash].js',
|
||
assetFileNames: 'assets/[name]-[hash][extname]',
|
||
},
|
||
},
|
||
},
|
||
})
|