46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { defineConfig, loadEnv, UserConfig } from 'vite'
|
|
import federation from "@originjs/vite-plugin-federation";
|
|
import { nacosRegVitePlugin } from "nacos-federation";
|
|
// @ts-ignore
|
|
import vue from '@vitejs/plugin-vue';
|
|
|
|
export default defineConfig(async ({ mode }): Promise<UserConfig> => {
|
|
const env = loadEnv(mode, process.cwd());
|
|
|
|
return {
|
|
base: `/${ env.VITE_SERVER_NAME }/`,
|
|
server: {
|
|
port: Number(env.VITE_SERVER_PORT),
|
|
host: '0.0.0.0',
|
|
strictPort: true,
|
|
cors: true
|
|
},
|
|
plugins: [
|
|
nacosRegVitePlugin(),
|
|
federation({
|
|
name: env.VITE_SERVER_NAME,
|
|
exposes: {
|
|
"./config": "./src/config/index.ts",
|
|
"./infra": "./src/infra/index.ts",
|
|
"./utils": "./src/utils/index.ts",
|
|
},
|
|
shared: {
|
|
axios: { requiredVersion: '^1.12.2' }
|
|
}
|
|
}),
|
|
vue()
|
|
],
|
|
build: {
|
|
target: 'esnext',
|
|
minify: false,
|
|
cssCodeSplit: true,
|
|
rollupOptions: {
|
|
input: './src/index.ts',
|
|
output: {
|
|
format: 'esm',
|
|
minifyInternalExports: false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}); |