From 36fdf3b05c1797f5734202a600da0e2d79874df9 Mon Sep 17 00:00:00 2001 From: Michael Withagen Date: Wed, 23 Jul 2025 15:40:54 +0200 Subject: [PATCH] Fix getting server port Update for Nuxt 4 compatibility --- src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8c640ce..ee6660e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -104,10 +104,9 @@ export default defineNuxtModule({ listen(server, listener) { // For `viteConfig.promise` can able resolved (async function _listen() { - const addressInfo = server.address() as AddressInfo Object.assign(process.env, { // This is required, and it is used in Electron-Main. - VITE_DEV_SERVER_URL: `http://localhost:${addressInfo.port}`, + VITE_DEV_SERVER_URL: `http://localhost:${listener.address.port}`, }) // https://github.com/electron-vite/vite-plugin-electron/blob/v0.11.2/src/index.ts#L37-L59