vite.config.js 668 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {
  2. defineConfig
  3. } from 'vite';
  4. import uni from '@dcloudio/vite-plugin-uni';
  5. export default defineConfig({
  6. plugins: [
  7. uni()
  8. ],
  9. server: {
  10. host: '127.0.0.1',
  11. port: 8080,
  12. proxy: {
  13. '/api': {
  14. target: 'http://localhost:8085',
  15. changeOrigin: true,
  16. rewrite: (path) => path.replace(/^\/api/, ''), // 此处进行路径重写
  17. }
  18. }
  19. },
  20. build: {
  21. minify: 'terser',
  22. terserOptions: {
  23. compress: {
  24. drop_console: true, // 移除console
  25. drop_debugger: true // 移除debugger
  26. }
  27. },
  28. rollupOptions: {
  29. output: {
  30. manualChunks: {
  31. // 将第三方库单独打包
  32. vendor: ['vue', 'vuex', 'vue-i18n']
  33. }
  34. }
  35. }
  36. }
  37. });