| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /*
- * @Description:
- * @Version: 1.668
- * @Autor: 地虎降天龙
- * @Date: 2025-12-26 08:14:02
- * @LastEditors: 地虎降天龙
- * @LastEditTime: 2026-01-09 09:23:31
- */
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import glsl from 'vite-plugin-glsl'
- import { templateCompilerOptions } from '@tresjs/core'
- import federation from '@originjs/vite-plugin-federation'
- import dcsConfig from './src/dcsConfig'
- // https://vitejs.dev/config/
- const exposeMap = {} as any
- dcsConfig.components.forEach((item: any) => {
- exposeMap[`./${item.type}`] = item.comFile
- })
- export default defineConfig(({ command }) => {
- return {
- // base: './',
- plugins: [
- vue({
- ...templateCompilerOptions,
- }),
- glsl(),
- federation({
- name: 'remote-tvt-components',
- filename: 'remoteEntry.js',
- exposes: {
- // 不可以使用多层目录
- './config': './src/dcsConfig.js',
- ...exposeMap,
- },
- shared: {
- vue: {},
- three: { requiredVersion: '0.180.0' },
- // "@tresjs/cientos": { requiredVersion: '5.2.1' },
- // "@tresjs/core": { requiredVersion: '5.2.1' },
- },
- }),
- ],
- build: {
- rollupOptions: {
- output: {
- manualChunks: {
- three: ['three'],
- '@tresjs/cientos': ['@tresjs/cientos']
- },
- },
- },
- },
- optimizeDeps: {
- exclude: command === 'build' ? ['vue', 'three', '@tresjs/cientos'] : ['vue', 'three']
- },
- }
- })
|