vite.config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import cesium from 'vite-plugin-cesium'
  5. // https://vitejs.dev/config/
  6. export default defineConfig({
  7. base: './', // 确保与部署路径匹配
  8. plugins: [
  9. vue(),
  10. cesium({
  11. // 关键配置:强制插件处理资源路径
  12. rebuildCesium: true
  13. })
  14. ],
  15. build: {
  16. // 确保资源文件不被重命名
  17. assetsInlineLimit: 0
  18. },
  19. resolve: {
  20. alias: {
  21. '@': fileURLToPath(new URL('./src', import.meta.url)),
  22. 'assets': fileURLToPath(new URL('./assets', import.meta.url)),
  23. '@three': fileURLToPath(new URL('./Three', import.meta.url))
  24. }
  25. },
  26. server: {
  27. proxy: {
  28. '/ventusky': {
  29. target: 'https://www.ventusky.com',
  30. changeOrigin: true,
  31. rewrite: (path) => path.replace(/^\/ventusky/, '')
  32. },
  33. '/nomads': {
  34. target: 'https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p50.pl',
  35. changeOrigin: true,
  36. rewrite: (path) => path.replace(/^\/nomads/, '')
  37. }
  38. }
  39. }
  40. })