46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { defineConfig, UserConfig } from 'vite'
|
|
import federation from "@originjs/vite-plugin-federation";
|
|
import { nacosServiceManage } from "nacos-federation";
|
|
// https://vite.dev/config/
|
|
export default defineConfig(async (): Promise<UserConfig> => {
|
|
new nacosServiceManage({
|
|
serverList: '192.168.31.100:8848',
|
|
serviceName: 'app-shared',
|
|
port: 1333
|
|
})
|
|
|
|
return {
|
|
server: {
|
|
port: 1333,
|
|
host: '0.0.0.0',
|
|
strictPort: true,
|
|
cors: true
|
|
},
|
|
plugins: [
|
|
federation({
|
|
name: 'shared',
|
|
exposes: {
|
|
"./config": "./src/config/index.ts",
|
|
"./infra": "./src/infra/index.ts",
|
|
"./utils": "./src/utils/index.ts",
|
|
},
|
|
shared: {
|
|
axios: { requiredVersion: '^1.12.2' }
|
|
}
|
|
})
|
|
],
|
|
build: {
|
|
target: 'esnext',
|
|
minify: false,
|
|
cssCodeSplit: true,
|
|
rollupOptions: {
|
|
input: './src/index.ts',
|
|
output: {
|
|
format: 'esm',
|
|
minifyInternalExports: false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|