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

182
Visualizações
JavaScript file missing when buildling

I have a vanilla JS application. I'm using Vite as a frontend build tool.

  <script src="./src/main.js"></script>
  <input type="button" value="Connect" onclick="connect();" />

The code above works locally, but when it builds, it does NOT produce JS file in the dist folder (which I set to deploy), and hence the program errors when deployed.

enter image description here

The error is Uncaught ReferenceError: connect is not defined at HTMLInputElement.onclick

How can I solve this? I deployed it to Firebase hosting using Vite to build.

Edit: I moved main branch to Svelte so it works, but vanilla js does not work, which is in the petite-vue branch. If you want to test it out for the error, please check out this branch.

The source code is here https://github.com/leochoo/emotion/blob/petite-vue/index.html

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

0

I think your project is a bit messed, I made you a working example vite + svelte + microbit available on Github :

  • https://github.com/flydev-fr/so-vite-svelte-microbit

Just clone the repo, then run yarn and yarn build

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