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

112
Views
Problemas al importar Cytoscape y Dagre en Js

Estoy tratando de usar Dagre con Cytoscape para visualizar árboles, pero tengo problemas al importar dagre y cytoscript en mi archivo javascript. Sigo recibiendo un error "las declaraciones de importación pueden aparecer solo en un nivel superior de un módulo".

Mi HTML:

 <!DOCTYPE html> <html lang="en"> <head> <title>Document</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="style.css" rel="stylesheet"> </head> <body> <div id="cy"></div> <script src="tree.js"></script> </body> </html>

Mi archivo js:

 import cytoscape from 'cytoscape'; import dagre from 'cytoscape-dagre'; cytoscape.use( dagre );

Al agregar type="module" a mi etiqueta de secuencia de comandos en HTML, aparece un error de tipo MIME (texto/html).

Instalé cytoscape-dagre a través de npm según las instrucciones en el repositorio de Github: npm install cytoscape-dagre https://github.com/cytoscape/cytoscape.js-dagre

Agradezco cualquier ayuda.

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!