42 lines
983 B
TypeScript
42 lines
983 B
TypeScript
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(() => {
|
|
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]`,
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: 'https://ipad.shenynet.com',
|
|
changeOrigin: true,
|
|
secure: true,
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
}
|
|
})
|