import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' import vueDevTools from 'vite-plugin-vue-devtools' import { visualizer } from 'rollup-plugin-visualizer' export default defineConfig({ plugins: [vue(), vueJsx(), vueDevTools(), visualizer()], server: { host: '0.0.0.0', port: 8100, proxy: { '/baiduSuggestion': { target: 'https://suggestion.baidu.com', changeOrigin: true, rewrite: (path) => path.replace(/^\/baiduSuggestion/, '/su') } } }, preview: { host: '0.0.0.0', port: 8200 }, resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, build: { // 禁用内联资源 assetsInlineLimit: 0, minify: 'terser', terserOptions: { compress: { drop_debugger: true, drop_console: ['log'] as any } } } })