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

217
Views
importing a javascript module

I'm trying to develop javascript that uses the three.js package, and I'm stuck at an early step of trying to import a module. In the html, I have

<script src="main.mj"></script>

And then in main.js I have

import * as THREE from './js/three.module.js';

But, my browser won't load the page, giving the error "Uncaught SyntaxError: Cannot use import statement outside a module". If I change the html code to read

<script src="main.mj" type=module></script>

Then I get

"Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec."

import * as THREE from './js/three.module.js';

I am pretty new to javascript, and I'd appreciate any advice. I'm editing on a local maching running an nginx webserver on localhost.

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