Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

91
Views
path problems when deploying angular app in Gitlab pages

I am currently testing an angular app/java microservices backend, and I deployed the front on Gitlab Pages.

The gitlab-ci.yml is pretty simple so far, as I'm just testing the architecture :

cache:
  paths:
    - node_modules/

stages:
  - staging
  
pages:
  image: node:latest
  stage: staging
  script:
    - npm install -g @angular/cli@11.0.1
    - npm install
    - ng build --prod
  artifacts:
    paths:
    - public

I changed the angular.json to output public/ instead of dist/. The site deploys well on the adress https://myaccount.gitlab.io/repository-name but only the index.html works.

The reason being, all the href inside are somehow wrong :

<script src="runtime.0e49e2b53282f40c8925.js" defer></script>
<script src="polyfills.e6e62ba5ee83d54cee93.js" defer></script>
<script src="main.26f4db6ed1e6241cbf51.js" defer></script>

The href point to https://myaccount.gitlab.io/runtime.0e49e2b53282f40c8925.js instead of https://myaccount.gitlab.io/repository-name/runtime.0e49e2b53282f40c8925.js, so all my refs throw 404 errors

Does anyone know why it's that way, and how to fix it ? thanks a lot !

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Well sorry for the inconvenience, I found a very simple answer to my own problem, so I'll post it here in case someone needs it.

it's possible to simply change the base-href of an angular build with

--base-href /your-path/

So I just changed my ng build like this :

- ng build --prod --base-href /croquis-time-client/
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!