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

223
Views
How to import JS modules in client sided JS files?

Sorry if the question wording is unclear. When I try to use the Ably module in my client-side js file, the object doesn't exist. I thought that javascript files within the same HTML file all had access to each other, so my client-side JS file would have access to Ably because I specified them both, but it won't function. If I type Ably in the JS file, which should let me access the methods of the Ably module, it does not recognize it and nothing happens(besides not found errors, of course)

Here is the HTML file

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./css/metronome.css">
    <title>whywontthiswork</title>
    <script lang="text/javascript" src="https://cdn.ably.com/lib/ably.min-1.js"></script>
    <script src="/public/app.js" type="module"></script>
</head>...

Here is the JS code segment that doesnt work because it won't recognize Ably and thinks its random text.

const client = new Ably.Realtime({ 
    key: "(my key)" 
});

Here is my file structure

├── public/
│   ├── app.js
├── views/
│   ├── metronome.html
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!