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

117
Visualizações
Heroku deploy: single page app as Frontend and express as Backend

I try to deploy my app on Heroku.

My stack:

Backend: Express + Mongodb + Typescript

Frontend: Express + Vanilla JS (Single Page App)

Backend was deployed and working fine, problem is with Frontend. I wish I had used React, because with React I would know what to do. Problem is Vanilla JS. I must say that everything is working on my localhost, so problem exist after Heroku deployment.

In my index.html I have this line:

<script type="module" src="/static/javascript/index.js"></script>

And I see on Heroku app html from index.html, no css and in console that error: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

I think this is because Heroku try to go to localization https://my-app.herokuapp.com/static/javascript/index.js. How to tell Heroku to treat this path like a subfolder with module, not like localization to go?

When I work with React I tell in package.json to build frontend npm run build, what is substitution for this in Vanilla JS? How to say Heroku that this is Vanilla JS and build this?

about 4 years ago · Juan Pablo Isaza
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