51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
import federation from '@originjs/vite-plugin-federation';
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
vueJsx(),
|
|
vueDevTools(),
|
|
federation({
|
|
name: 'mainApp', // 主应用模块名(联邦模块需通过此名引用)
|
|
remotes: { // 配置远程联邦模块地址(开发/生产需对应)
|
|
productModule: 'http://localhost:5001/assets/remoteEntry.js'
|
|
},
|
|
exposes: {
|
|
"./shared": "./src/shared/index.ts",
|
|
"./productService": "./src/app/di/productModule.ts",
|
|
},
|
|
shared: {
|
|
vue: { requiredVersion: '^3.5.18' },
|
|
axios: { requiredVersion: '^1.12.2' },
|
|
'vue-router': { requiredVersion: '^4.0.6' },
|
|
pinia: { requiredVersion: '^3.0.3' }
|
|
}
|
|
})
|
|
],
|
|
build: {
|
|
target: 'esnext',
|
|
minify: false,
|
|
cssCodeSplit: true,
|
|
rollupOptions: {
|
|
output: {
|
|
minifyInternalExports: false
|
|
}
|
|
}
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src/app/', import.meta.url)),
|
|
'@shared': fileURLToPath(new URL('./src/shared/', import.meta.url)),
|
|
'@features': fileURLToPath(new URL('./src/features/', import.meta.url)),
|
|
'@domains': fileURLToPath(new URL('./src/domains/', import.meta.url))
|
|
},
|
|
},
|
|
})
|