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

197
Vistas
How to use peerjs (import and require both fail)

I want to use peerjs in a script (that I use in a html file). When I try import Peer from "peerjs", I get an error saying "Cannot use import statement outside a module". When I try var Peer = require("peerjs"), I get an error saying simply "require is not defined". Is there a way to use peerjs ? If yes, what is it ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

if you want to use a library inside an HTML file you need to include its file in a script tag.
for example in your case, PeerJS documentation instructs to add this line:

<script src="https://unpkg.com/peerjs@1.3.2/dist/peerjs.min.js"></script>

and then you can create a peer and connect.

take a look here: PeerJS

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