Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

232
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda