vite.config.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import legacy from '@vitejs/plugin-legacy'
  4. import path from 'path'
  5. // https://vitejs.dev/config/
  6. export default defineConfig({
  7. plugins: [
  8. vue(),
  9. legacy({
  10. polyfills: ['es.promise.finally', 'es/map', 'es/set'],
  11. modernPolyfills: ['es.promise.finally']
  12. })
  13. ],
  14. server: {
  15. port: 3000,
  16. cors: true,
  17. host: '0.0.0.0',
  18. proxy: {
  19. '/v1': {
  20. // target: 'http://8.136.199.33:8608',
  21. target: 'https://charttest.hzinsights.com',
  22. changeOrigin: true,
  23. rewrite: (path) => path.replace(/^\/v1/, '/v1')
  24. }
  25. },
  26. },
  27. build: {
  28. outDir: 'eta_chart_front',
  29. chunkSizeWarningLimit: 1000,//单文件过1000kb警告
  30. },
  31. resolve: {
  32. alias: {
  33. '@': path.resolve(__dirname, './src')
  34. },
  35. },
  36. css: {
  37. postcss: {
  38. plugins: [
  39. {
  40. postcssPlugin: 'internal:charset-removal',
  41. AtRule: {
  42. charset: (atRule) => {
  43. if (atRule.name === 'charset') {
  44. atRule.remove()
  45. }
  46. }
  47. }
  48. }
  49. ]
  50. }
  51. }
  52. })