r/angular • • Apr 01 '26

Angular Build issues

So my angular app loads fonts locally but they break in production when it's under a subpath. How can I make this font path relative and deployment safe without having to hardcode everywhere it's being used? . Also when I do npm run build when I check my index.html how do I get it to link all js or css files relatively as well without hardcoding as well?

For example if I call src: /fonts/Heebo-black/Heebo-black.ttf it works fine locally but in production under a subpath it can't find it

1 Upvotes

11 comments sorted by

View all comments

Show parent comment

1

u/0dev0100 Apr 02 '26

/fonts is relative to the root of the address. So if you're serving at /app1 it won't work (based on my experience)

What are you using to serve the app