.fes.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * @Description:
  3. * @Version: 1.668
  4. * @Autor: 地虎降天龙
  5. * @Date: 2023-10-16 10:53:09
  6. * @LastEditors: 地虎降天龙
  7. * @LastEditTime: 2025-12-31 11:44:50
  8. */
  9. import { defineBuildConfig } from '@fesjs/fes'
  10. import cesiumStatic from './src/common/cesiumStaticPlugin.js'
  11. import localGisStatic from './src/common/localGisStaticPlugin.js'
  12. import cockpitStatic from './src/common/cockpitStaticPlugin.js'
  13. import cockpitEnvPlugin from './src/common/cockpitEnvPlugin.js'
  14. export default defineBuildConfig({
  15. mountElementId: 'tvt-app',
  16. title: '沅陵城市生命线驾驶舱系统',
  17. publicPath: './',
  18. // 显式入口,不再让新增页面或上游示例自动进入构建。
  19. router: {
  20. mode: 'hash',
  21. routes: [
  22. { path: '/', component: '@/pages/index.vue' },
  23. { path: '/cockpit', component: '@/pages/cockpit/index.vue' },
  24. { path: '/:pathMatch(.*)*', redirect: '/cockpit' },
  25. ],
  26. },
  27. viteOption: {
  28. plugins: [
  29. {
  30. name: 'cockpit-development-port',
  31. configResolved(config) {
  32. if (config.command === 'serve' && config.server.port !== 8000) {
  33. throw new Error('驾驶舱开发入口固定 localhost:8000;请检查端口占用,不另开端口。')
  34. }
  35. },
  36. },
  37. cesiumStatic(),
  38. localGisStatic(),
  39. cockpitStatic(),
  40. cockpitEnvPlugin(),
  41. ],
  42. build: {
  43. target: 'esnext',
  44. chunkSizeWarningLimit: 1000,
  45. copyPublicDir: false,
  46. rollupOptions: {
  47. output: {
  48. // 只为真正被引用的引擎分包,不用对象形式强制拉入未使用库。
  49. manualChunks(id) {
  50. const moduleId = id.replaceAll('\\', '/')
  51. if (moduleId.includes('/node_modules/cesium/') || moduleId.includes('/node_modules/@cesium/')) return 'cesium'
  52. if (moduleId.includes('/node_modules/three/')) return 'three'
  53. },
  54. chunkFileNames: 'js/[name].[hash].js',
  55. entryFileNames: 'js/[name].[hash].js',
  56. assetFileNames: '[ext]/[name].[hash].[ext]',
  57. },
  58. },
  59. sourcemap: false,
  60. minify: 'terser',
  61. },
  62. server: {
  63. host: '0.0.0.0',
  64. port: 8000,
  65. strictPort: true,
  66. watch: {
  67. ignored: [
  68. '**/.scratch/**', '**/.scratch-cache*/**', '**/.local-archive/**',
  69. '**/.dsh-*', '**/*.tmpdir', '**/*.tmpdir/**',
  70. '**/tools/**', '**/DesignAssets/**', '**/dynamic-component-service-master/**',
  71. '**/docs/**', '**/openspec/**', '**/skills/**', '**/verify/**',
  72. '**/after-deploy/**', '**/.cache/**', '**/.qoder/**', '**/.idea/**',
  73. ],
  74. },
  75. },
  76. },
  77. })