745cdd79cf
Implements the Revision 8/9 compliance design: tenant + ops backends, ops-web content-safety pages, admin-web editor/publish gate integration, desktop publish block surfacing, and supporting migrations / shared types / config plumbing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { defineConfig, loadEnv, type PluginOption } from 'vite'
|
|
import { compression } from 'vite-plugin-compression2'
|
|
|
|
const r = (path: string) => fileURLToPath(new URL(path, import.meta.url))
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, '.', '')
|
|
const isProd = mode === 'production'
|
|
const plugins: PluginOption[] = [vue()]
|
|
|
|
if (isProd) {
|
|
plugins.push(
|
|
compression({
|
|
algorithms: ['gzip', 'brotliCompress'],
|
|
threshold: 1024,
|
|
}),
|
|
)
|
|
}
|
|
|
|
return {
|
|
plugins,
|
|
resolve: {
|
|
alias: {
|
|
'@': r('./src'),
|
|
'@geo/shared-types': r('../../packages/shared-types/src/index.ts'),
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5174,
|
|
proxy: {
|
|
'/api': {
|
|
target: env.VITE_OPS_API_PROXY_TARGET || 'http://localhost:8090',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
esbuild: isProd ? { drop: ['console', 'debugger'] } : undefined,
|
|
build: {
|
|
target: 'es2022',
|
|
sourcemap: 'hidden',
|
|
cssCodeSplit: true,
|
|
reportCompressedSize: false,
|
|
rollupOptions: {
|
|
output: {
|
|
entryFileNames: 'assets/js/[name]-[hash].js',
|
|
chunkFileNames: 'assets/js/[name]-[hash].js',
|
|
assetFileNames: 'assets/[name]-[hash][extname]',
|
|
manualChunks(id) {
|
|
if (!id.includes('node_modules')) return undefined
|
|
if (id.includes('/ant-design-vue/') || id.includes('/@ant-design/')) {
|
|
return 'antd'
|
|
}
|
|
if (
|
|
id.includes('/vue/') ||
|
|
id.includes('/@vue/') ||
|
|
id.includes('/vue-router/') ||
|
|
id.includes('/pinia/')
|
|
) {
|
|
return 'vue-vendor'
|
|
}
|
|
return 'vendor'
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
})
|