简体   繁体   中英

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 . When built and deployed this way, the generated styles, polyfills, and main js files return 403 errors. 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'. Adding a production route to the angular routing breaks everything completely. Is there a way to fix this pathing issue?

Try using the deployUrl option in angular.json

deployUrl: '/production/'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM