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

183
Views
Javascript: Infinite loop for import and script type error

I'm running a website on localhost:8000 and I'm currently in an infinite loop for fixing this problem. This is the line for using the javascript file in my html file:

    <script type="text/javascript" src="./scripts/main.js"></script>

I set the type to "text/javascript" because I got this error: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". According to this post I had to change type="module" to type="text/javascript", which fixed the error indeed, but then I got a new error: Uncaught SyntaxError: Cannot use import statement outside a module. According to this post I need to use type="module" and now I'm in a infinite loop.

package.json:

{
    ...
    "main": "main.js",
    "type": "module",
    ...

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If the console no longer throws a module related error, I'd guess that the infinite loop problem is related to the code itself.

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!