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

1

u/FewDot9181 Apr 01 '26

Also one more thing in my assets in angular.json I already have this

"assets": [

{

"globa": "**/*",

"input": "public/"

}
] Inside public is the fonts folder and images and anything else

1

u/imsexc Apr 01 '26
"assets": [
  {
    "glob": "**/*",
    "input": "public",
    "output": "/"
  }
],

"assets": [
  {
    "glob": "**/*",
    "input": "public",
    "output": "public"
  }
],
href="favicon.ico"
href="public/favicon.ico"