-
Notifications
You must be signed in to change notification settings - Fork 12k
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
ng serve does not work with --base-href #6289
Comments
This is really, and unfortunately, more complicated than just adjusting the Dev server's public path. The base href adjusts all requests coming from within the index.html file; it doesn't predicate the actual location of the index.html file. I'm not sure how complicated and detailed a Dev server should actually be. |
@clydin could you elaborate a bit more why it'd be a bit more complicated than setting publicPath to the specified baseHref ? I tested it out on a new application, as well as a mature application with multiple routes / nested routes / and external libraries. The only error I encountered was having a |
What the There is also the |
I understand I found the bug while trying to use Since the current behavior of I agree with you that a dev server shouldn't be too complicated or detailed. Which is why a small change to make It is true if that if you have absolute paths for images like |
Your proxy example should work without any code changes. The setup needs to be configured to proxy the public location In regards to my last paragraph, i was referring to the usage of both the base href option and the deploy url option in combination. The following are both valid configurations with very different behavior:
I think instead of trying to guess the intentions of the developer, a For reference, also see these PRs (#6279, #6112) which are all trying to address a similar problem in potentially conflicting ways when accounting for base href as well. |
My proxy example as is does not work on in the current release of the cli .. Since I mentioned out of the box #6279 was definitely one of the things I tried and that PR would have fixed. As for #6112 it seems to be setting I agree a |
@clydin do you know if there is something I am missing about #6112 ? I double checked my logs to make sure to have I have that commit, and trying out |
#6112 Fixes exactly the issue reported here. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
Repro steps.
ng new serve-with-base-href && cd serve-with-base-href/
ng serve --base-href '/test/'
http://localhost:4200/test/
The log given by the failure.
Desired functionality.
To be able to run
ng serve
under a different--base-href
Mention any other details that might be useful.
The text was updated successfully, but these errors were encountered: