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

Display url of app entry file to user after webpack-dev-server start #189

Open
filoxo opened this issue Oct 1, 2020 · 3 comments
Open

Comments

@filoxo
Copy link
Contributor

filoxo commented Oct 1, 2020

I had a minor idea but I'm not sure how much value it provides so I'm sharing it here for feedback. I think the base Webpack config could display the url of the app entry file to the user after webpack-dev-server has started. Currently one would have to extrapolate this from places in webpack's output. Here's a more concrete example of what I mean:

Screen Shot 2020-10-01 at 4 26 52 PM

In the above, the entry file can be extrapolated from the two lines that I've highlighted. But its a lot to parse through (which is unfriendly to both beginners and experienced devs) and requires having to copy and paste twice. We could fairly easily add a line that logs with that URL already displayed.

Screen Shot 2020-10-01 at 4 31 27 PM

Note the 4th line after the command has started. Many terminals also allow the user to CMD+click URLs to open them up immediately. Here is my naive implementation:

devServer: {
  after: (app, server, compiler) => {
    const { https = false, host, port, publicPath, filename } = compiler.options.devServer;
    console.log(`⚡️ single-spa application entry: \x1b[36m%s\x1b[0m`, `${https ? "https://" : "http://"}${host}${!!port ? `:${port}` : ""}${publicPath}${filename}`)
  }
}

This could be taken a step further into showing the type of application (eg root-config running at: https://localhost:4321/index.html), framework, or other configuration info that might helpful.

@joeldenning
Copy link
Member

I think this is a great idea and would really help people.

@filoxo
Copy link
Contributor Author

filoxo commented Oct 15, 2020

I had originally implemented this with webpack devServer's after but I think that onListening is probably a better hook to use.

@filoxo
Copy link
Contributor Author

filoxo commented Jan 25, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants