Skip to content

yarn start allocates port 8000 all the time in addition to 4242 (or custom port) #5881

@canova

Description

@canova

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:

const { hosts, port: esbuildServerPort } = await buildContext.serve({

And another one is that we actually use with 4242 port:

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.

Metadata

Metadata

Assignees

Labels

code maintenanceIssues that are not user facing, but are related the technical debt with the code itself

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions