[英]Angular universal build baseHref change breaks angular routing in app
I have an angular application set up to build prior to deployment to AWS lambda. The serverless.yml
file uses the stage: production
entry, prefixing the deployment with /production
.我有一个 angular 应用程序设置为在部署到 AWS lambda 之前构建
serverless.yml
文件使用stage: production
条目,在部署前加上前缀/production
。 When built and deployed this way, the generated styles, polyfills, and main js files return 403 errors.以这种方式构建和部署时,生成的 styles、polyfill 和主要 js 文件返回 403 错误。 If I change the production build
baseHref: production/
in angular.json, the files can be found when deployed, but the angular routing breaks due to an unmatching url segment 'production'.如果我在 angular.json 中更改生产构建
baseHref: production/
,则可以在部署时找到这些文件,但 angular 路由由于不匹配的 url 段“生产”而中断。 Adding a production route to the angular routing breaks everything completely.将生产路线添加到 angular 路线会彻底破坏一切。 Is there a way to fix this pathing issue?
有没有办法解决这个路径问题?
Try using the deployUrl
option in angular.json
尝试使用
angular.json
中的deployUrl
选项
deployUrl: '/production/'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.