/* * @Description: * @Version: 1.668 * @Autor: 地虎降天龙 * @Date: 2023-10-16 10:53:09 * @LastEditors: 地虎降天龙 * @LastEditTime: 2025-12-31 11:44:50 */ import { defineBuildConfig } from '@fesjs/fes' import cesiumStatic from './src/common/cesiumStaticPlugin.js' import localGisStatic from './src/common/localGisStaticPlugin.js' import cockpitStatic from './src/common/cockpitStaticPlugin.js' import cockpitEnvPlugin from './src/common/cockpitEnvPlugin.js' export default defineBuildConfig({ mountElementId: 'tvt-app', title: '沅陵城市生命线驾驶舱系统', publicPath: './', // 显式入口,不再让新增页面或上游示例自动进入构建。 router: { mode: 'hash', routes: [ { path: '/', component: '@/pages/index.vue' }, { path: '/cockpit', component: '@/pages/cockpit/index.vue' }, { path: '/:pathMatch(.*)*', redirect: '/cockpit' }, ], }, viteOption: { plugins: [ { name: 'cockpit-development-port', configResolved(config) { if (config.command === 'serve' && config.server.port !== 8000) { throw new Error('驾驶舱开发入口固定 localhost:8000;请检查端口占用,不另开端口。') } }, }, cesiumStatic(), localGisStatic(), cockpitStatic(), cockpitEnvPlugin(), ], build: { target: 'esnext', chunkSizeWarningLimit: 1000, copyPublicDir: false, rollupOptions: { output: { // 只为真正被引用的引擎分包,不用对象形式强制拉入未使用库。 manualChunks(id) { const moduleId = id.replaceAll('\\', '/') if (moduleId.includes('/node_modules/cesium/') || moduleId.includes('/node_modules/@cesium/')) return 'cesium' if (moduleId.includes('/node_modules/three/')) return 'three' }, chunkFileNames: 'js/[name].[hash].js', entryFileNames: 'js/[name].[hash].js', assetFileNames: '[ext]/[name].[hash].[ext]', }, }, sourcemap: false, minify: 'terser', }, server: { host: '0.0.0.0', port: 8000, strictPort: true, watch: { ignored: [ '**/.scratch/**', '**/.scratch-cache*/**', '**/.local-archive/**', '**/.dsh-*', '**/*.tmpdir', '**/*.tmpdir/**', '**/tools/**', '**/DesignAssets/**', '**/dynamic-component-service-master/**', '**/docs/**', '**/openspec/**', '**/skills/**', '**/verify/**', '**/after-deploy/**', '**/.cache/**', '**/.qoder/**', '**/.idea/**', ], }, }, }, })