实现 nacos + traefik,改了很多东西!!!
This commit is contained in:
@@ -1,24 +1,26 @@
|
||||
import { defineConfig, UserConfig } from 'vite'
|
||||
import { defineConfig, loadEnv, 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
|
||||
})
|
||||
|
||||
export default defineConfig(async ({ mode }): Promise<UserConfig> => {
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
await nacosServiceManage.create({
|
||||
serverList: env.VITE_NACOS_ADDRESS,
|
||||
serviceName: env.VITE_SERVER_NAME,
|
||||
port: Number(env.VITE_SERVER_PORT)
|
||||
});
|
||||
|
||||
return {
|
||||
base: `/${ env.VITE_SERVER_NAME }/`,
|
||||
server: {
|
||||
port: 1333,
|
||||
port: Number(env.VITE_SERVER_PORT),
|
||||
host: '0.0.0.0',
|
||||
strictPort: true,
|
||||
cors: true
|
||||
},
|
||||
plugins: [
|
||||
federation({
|
||||
name: 'shared',
|
||||
name: env.VITE_SERVER_NAME,
|
||||
exposes: {
|
||||
"./config": "./src/config/index.ts",
|
||||
"./infra": "./src/infra/index.ts",
|
||||
@@ -42,4 +44,4 @@ export default defineConfig(async (): Promise<UserConfig> => {
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user