We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eecf725 commit 74f2198Copy full SHA for 74f2198
src/build/vite/preview.ts
@@ -68,7 +68,7 @@ export function nitroPreviewPlugin(ctx: NitroPluginContext): VitePlugin {
68
consola.info(buildInfo.commands?.preview);
69
console.log("");
70
71
- const { getRandomPort } = await import("get-port-please");
+ const { getRandomPort, waitForPort } = await import("get-port-please");
72
const randomPort = await getRandomPort();
73
const child = spawn(command, args, {
74
stdio: "inherit",
@@ -116,6 +116,8 @@ export function nitroPreviewPlugin(ctx: NitroPluginContext): VitePlugin {
116
res.end(`Nitro preview server is not running.`);
117
}
118
});
119
+
120
+ await waitForPort(randomPort, { retries: 20, delay: 500 });
121
},
122
} satisfies VitePlugin;
123
0 commit comments