@@ -2,9 +2,11 @@ import { spawn } from 'node:child_process'
22import { join } from 'node:path'
33import { fileURLToPath } from 'node:url'
44import { packagesDir } from '../constants.ts'
5+ import { getHost } from '../serve/common.ts'
56import { runBenchmark } from './run-benchmark.ts'
67import type { ClientSideRenderedBenchmarkResult } from './types.ts'
78
9+ const CLIENT_SIDE_RENDERED_HOST = getHost ( )
810const CLIENT_SIDE_RENDERED_PORT = 3001
911
1012interface ClientSideRenderedFrameworkConfig {
@@ -85,6 +87,7 @@ async function spawnServer(
8587 const proc = spawn ( 'node' , [ scriptPath , appDir ] , {
8688 env : {
8789 ...process . env ,
90+ HOST : CLIENT_SIDE_RENDERED_HOST ,
8891 NODE_ENV : 'production' ,
8992 PORT : String ( CLIENT_SIDE_RENDERED_PORT ) ,
9093 } ,
@@ -116,7 +119,7 @@ async function spawnServer(
116119
117120 await Promise . race ( [
118121 waitForServer (
119- `http://localhost :${ CLIENT_SIDE_RENDERED_PORT } /client-side-rendered` ,
122+ `http://${ CLIENT_SIDE_RENDERED_HOST } :${ CLIENT_SIDE_RENDERED_PORT } /client-side-rendered` ,
120123 ) ,
121124 exitPromise ,
122125 ] )
@@ -148,7 +151,7 @@ export async function runClientSideRenderedBenchmark(
148151 `Running client-side rendered benchmark for ${ config . displayName } ...` ,
149152 )
150153 return await runBenchmark (
151- `http://localhost :${ CLIENT_SIDE_RENDERED_PORT } ` ,
154+ `http://${ CLIENT_SIDE_RENDERED_HOST } :${ CLIENT_SIDE_RENDERED_PORT } ` ,
152155 config . name ,
153156 config . displayName ,
154157 runs ,
0 commit comments