http-server icon indicating copy to clipboard operation
http-server copied to clipboard

How to serve build with homepage property set?

Open jacknugent opened this issue 3 years ago • 2 comments

In my package json, if I set the homepage like this:

homepage: "/path"

Is there any way to run http-server such that I can run the app from that specified subdomain? Something like localhost:3000/path? Currently, I can only get 404s (as expected) because the app expects to be run at /path

Unfortunately, I cannot simply replace /path with . like the Create React App docs suggest because I am using pushState on IIS:

If you are not using the HTML5 pushState history API or not using client-side routing at all, it is unnecessary to specify the URL from which your app will be served.

Cross posted in serve

jacknugent avatar Apr 27 '22 18:04 jacknugent

I guess baseDir option proposed in https://github.com/http-party/http-server/pull/294 is what you want.

Alternatively you can create folder build/path and let http-server serve the whole build folder (if you can't change your directory structure, build/path could be just a symlink in your filesystem to the folder with actual content).

zbynek avatar Apr 27 '22 19:04 zbynek

This issue has been inactive for 180 days

github-actions[bot] avatar Oct 25 '22 12:10 github-actions[bot]