Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[heft] Webpack dev server URL should be displayed more prominently #4213

Open
octogonz opened this issue Jun 20, 2023 · 2 comments
Open

[heft] Webpack dev server URL should be displayed more prominently #4213

octogonz opened this issue Jun 20, 2023 · 2 comments
Labels
effort: easy Probably a quick fix. Want to contribute? :-) enhancement The issue is asking for a new feature or design change help wanted If you're looking to contribute, this issue is a good place to start!
Projects

Comments

@octogonz
Copy link
Collaborator

octogonz commented Jun 20, 2023

Summary

I created a similar GitHub issue for the webpack-dev-server project: webpack/webpack-dev-server#4907

But Heft has its own reimplementation of this logic, so @rushstack/heft-webpack5-plugin requires a separate fix, tracked by this issue.

Repro steps

  1. Clone the Rush Stack monorepo
  2. cd apps/lockfile-explorer-web
  3. rush install && rush build -T . && rushx start

You will see output like this:

image

Heft helpfully prints the URL of the localhost dev server, however there are a couple usability problems with the design:

  1. The URL is difficult to discern in those logs. The webpack-dev-server prints it using ANSI color, which is much better. Maybe we could even include an emoji such as ➡️ Started dev server at: https://127.0.0.1:8096
  2. The URL is only printed once. After several rebuilds, it will get scrolled off the screen. The workaround is to kill and restart the dev server, but for large projects this can mean waiting several minutes for initialization.

Details

Heft's implementation is here:

onListening: (server: TWebpackDevServer) => {
const addressInfo: AddressInfo | string | undefined = server.server?.address() as AddressInfo;
if (addressInfo) {
const address: string =
typeof addressInfo === 'string' ? addressInfo : `${addressInfo.address}:${addressInfo.port}`;
taskSession.logger.terminal.writeLine(`Started Webpack Dev Server at https://${address}`);
}
}

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@rushstack/heft version? 0.56.0
Operating system? Windows
Node.js version (node -v)? v16.15.1
@octogonz octogonz added enhancement The issue is asking for a new feature or design change help wanted If you're looking to contribute, this issue is a good place to start! effort: easy Probably a quick fix. Want to contribute? :-) labels Jun 20, 2023
@iclanton
Copy link
Member

We could use the printMessageInBox function from @rushstack/terminal.

@iclanton iclanton added this to Low priority in Bug Triage Jun 26, 2023
@dmichon-msft
Copy link
Contributor

If running via https, it is helpful to emit as the host all accepted common names of the certificate, rather than just the IP address (which might not itself be one of said common names). I have logic for this in the rush-serve-plugin that we might consider borrowing here.

More broadly, I wonder if we might want to add some metadata category to task logs for information that should be surfaced at the end of a build, e.g. right before the "Waiting for changes" message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: easy Probably a quick fix. Want to contribute? :-) enhancement The issue is asking for a new feature or design change help wanted If you're looking to contribute, this issue is a good place to start!
Projects
Status: Low priority
Bug Triage
  
Low priority
Development

No branches or pull requests

3 participants