.fes.js 3.1 KB

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