vite.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. host: '0.0.0.0',
  28. proxy: {
  29. '/ventusky': {
  30. target: 'https://www.ventusky.com',
  31. changeOrigin: true,
  32. rewrite: (path) => path.replace(/^\/ventusky/, '')
  33. },
  34. '/nomads': {
  35. target: 'https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p50.pl',
  36. changeOrigin: true,
  37. rewrite: (path) => path.replace(/^\/nomads/, '')
  38. }
  39. }
  40. }
  41. })