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

164
Views
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 answers
Answer question

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 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!