xyyd-fatfox/vite.config.ts

43 lines
975 B
TypeScript
Raw Normal View History

2024-09-09 17:53:07 +08:00
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
}
}
}
})