我有一个 Angular 应用程序,它使用以下配置在端口 4300 上启动:
"scripts": {
"ng": "ng",
"start": "ng serve --port 4300 --host 0.0.0.0 --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}
该应用程序可访问以下网址:
http://localhost:4300/#/index.html
我想在上下文根上提供它,例如:“/myApp/”
应用程序必须始终以 开头npm start
,我想访问 url:
http://localhost:4300/myApp/#/index.html
我该怎么做?
我尝试的一切都不起作用:
- 设置
<base href="/myApp/">
不起作用 - 设置
"build": "ng build --prod --base-href=myApp"
不起作用
任何帮助将不胜感激。