Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda