I can set base href when building "ng build --prod --bh /ui/" but I can't do that when running development server with "ng serve". It would be nice to some way to set it up easily.
Why you need that? Just make it opposite: use default "/" for development and "/ui/" for production.
I am using "ng serve" for development (base href: "/", and mocked back-end)
and to quickly test it with real back-end and for that i need to have base href set to "/ui/" (all our services are behind proxy).
ng serve doesn't support base href, and we're not looking at supporting it at the moment.
@kpociecha I managed to run serve with base href using a proxy. It's not perfect but will do the job for the time being.
If the base href I need is project then:
ng serve --proxy-config proxy.conf.json --live-reload-base-url /project/
And in proxy.cong.json:
[
{
"context": [
"/project"
],
"target": {
"host": "localhost",
"protocol": "http:",
"port": 4200
},
"secure": false,
"pathRewrite": {
"^/project": "/"
}
}
]
In index.html (_we need to set this manually because --bh won't work with ng serve_):
<base href="/editor/">
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._