-
Notifications
You must be signed in to change notification settings - Fork 458
Description
I noticed this while building another project that uses localhost:8000. It looks like we are exposing two localhost ports in for the development server.
One is coming from buildContext.serve here:
profiler/scripts/lib/dev-server.mjs
Line 64 in 2eba5df
| const { hosts, port: esbuildServerPort } = await buildContext.serve({ |
And another one is that we actually use with 4242 port:
profiler/scripts/lib/dev-server.mjs
Lines 113 to 118 in 2eba5df
| server.listen(port, host, () => { | |
| if (onServerStart) { | |
| onServerStart(`http://${host}:${port}`); | |
| } | |
| resolve(); | |
| }); |
In the first one, esbuild always allocates localhost:8000, which is easy to block other projects since that port is used pretty frequently.
It looks like we did this 2 step to implement the middleware approach (the second one does some header checks and adds headers to the response. It's not possible to do it with pure esbuild). I don't know how much it's necessary, but probably it was there in the previous webpack implementation.