import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { fileURLToPath, URL } from 'node:url' export default defineConfig(({ command }) => ({ plugins: [vue()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, server: { port: 23811, host: true, open: true, proxy: { '/api': { target: 'http://127.0.0.1:23822/', //target: 'http://8.134.120.132:23822/', changeOrigin: true } } }, // 打包配置 build: { // https://vite.dev/config/build-options.html sourcemap: command === 'build' ? false : 'inline', target: 'es2018', outDir: 'dist', assetsDir: 'assets', chunkSizeWarningLimit: 2000, rollupOptions: { output: { // JS 拆分 chunkFileNames: 'static/js/[name]-[hash].js', entryFileNames: 'static/js/[name]-[hash].js', // 资源文件 assetFileNames: 'static/[ext]/[name]-[hash].[ext]', // 手动拆包 manualChunks: { vue: ['vue'], hls: ['hls.js'] } } } } }))