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

323
Views
How to use module from Github in javascript?

I am trying to use a library from GitHub found here: https://github.com/cubing/jsss

the readMe has an example of how to use it:

// index.html
<script src="index.js" type="module" defer></script>

<select id="eventID">
  <option value="333" selected>3x3x3</option>
  <option value="444">4x4x4</option>
</select>
<button id="new-scramble">New scramble</button><br>

<div id="scramble-string"></div>
// index.js
import { randomScrambleStringForEvent } from "scrambles";

const eventSelect = document.querySelector("#eventID");
const scrambleStringElem = document.querySelector("#scramble-string");

async function newScramble() {
  scrambleStringElem.textContent += " ⏳";
  const scrambleString = await randomScrambleStringForEvent(eventSelect.value);
  scrambleStringElem.textContent = scrambleString;
}

document.querySelector("#eventID").addEventListener("change", newScramble);
document.querySelector("#new-scramble").addEventListener("click", newScramble);
newScramble(); // Initial scramble

The repo is full of so many folders I am not sure which ones I need. I used the src to and put this in a folder called libs with but I have no idea if this is right. I tried using the whole repo and it still didn't work. Whenever I try following the "full example" that they have I get an error. As someone who has never done this before:

  1. Where do I put the index.js file
  2. what files do I need to copy to my project to make this work

Putting index.html and index.js in the root directory I get the error 'Uncaught TypeError: Failed to resolve module specifier "scrambles". Relative references must start with either "/", "./", or "../".'

When adding the correct directory to scrambles, I get the error 'Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.'

In short I have no idea what I am doing and no idea how to use this in my project, please help...

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!