r/Angular2 • • 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

2 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/FewDot9181 Apr 01 '26

thing is when I deploy to an actual environment where there is a subfolder it's not able to find those files undless if I alter the base ref from index.html. I'm trying to have it working without having to alter the base ref in the html file so that's why I asked for relative

1

u/0dev0100 Apr 02 '26

You can't.

Base href needs to be the subfolder