wwf
16 小时以前 38712ae83223cb244020e255fc37e1ce35775c45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { fileURLToPath, URL } from 'node:url'
 
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
const timestamp = new Date().getTime()
// https://vite.dev/config/
export default defineConfig({
  base: '/examination/user',
  plugins: [vue(), vueDevTools()],
  define: {
    // 注入构建时间戳到代码中
    '__BUILD_TIME__': JSON.stringify(timestamp)
  },
  rollupOptions: {
    output: {
      // 在文件名中加入时间戳,确保每次构建都不同
      entryFileNames: `assets/js/[name]-[hash]-${timestamp}.js`,
      chunkFileNames: `assets/js/[name]-[hash]-${timestamp}.js`,
      assetFileNames: `assets/[ext]/[name]-[hash]-${timestamp}.[ext]`
    }
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
  server: {
    allowedHosts: ['dev.qxueyou.com'],
    host: '0.0.0.0',
    proxy: {
      '/app-api': {
        target: 'http://101.43.143.75:48180', // dev
        changeOrigin: true,
      },
    },
    port: 5174
  },
})