Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

129
Visualizações
Problems deploying Vue project after build on Apache webserver due to wrong relative paths

I have a simple Vue.js project. I ran the command yarn build, then copied all the files inside dist/ folder onto Apache webserver.

When my URL pointed to the generated index.html, nothing appeared. I discovered this was due index.html pointing to the wrong relative paths that contain the js and CSS files.

For example, I noticed this wrong relative inside index.html <script type=module src=/js/app.4dcb0a0b.js></script> The correct one should be <script type=module src=./js/app.4dcb0a0b.js></script> It should be ./js and not /js.

After I corrected the relative paths, index.html appear correctly.

It is tedious if I have to manually change the wrong relative paths every time. How can I have a better solution?

I am using @vue/cli 5.0.1, yarn v1.22.17

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I will answer my own question.

Credit for the answer goes to this article

https://medium.com/js-dojo/how-to-solve-vue-js-prod-build-assets-relative-path-problem-71f91138dd79

Solution is to add the following line to vue.config.js;

module.exports = {publicPath: ''};

I do not know why this solution works. If someone knows, please drop some comments. Thank you.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda