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

141
Vistas
js code with type="module" is doesn't work in my vr environment

I work in a vr environement codding with A-FRAME, I use https://github.com/supermedium/superframe/tree/master/components/log/ to prints logs in vr environement.

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.9.0/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-log-component/dist/aframe-log-component.min.js"></script>
  <script type="module" src="./f1.js"></script>
  <script type="module" src="./f2.js"></script>
</head>

<body>
  <a-scene id='main_scene'>
    <a-entity log="channel:c1" geometry="primitive: plane" material="color: #111" text="color: lightgreen" position="0 0 -4"></a-entity>
  </a-scene>
</body>

And in my js I have this:

//f1.js
import foo from 'f2.js'

function f(ts){
  //...
  $('#main_scene').append('<a-entity obj'+ts.name+'></a-entity>');
  AFRAME.registerComponent(
      'obj'+ts.name,
      {
          init:function(){
              var el = this.el;
              el.setAttribute("geometry","primitive:box;depth:"+0.01+";height:"+0.06+";width:"+0.04);
              el.setAttribute('color',"#027523");
              el.setAttribute('position',{x:ts.x,y:ts.y,z:ts.z});
              el.setAttribute('rotation',{x:0,y:ts.orientation,z:0});
          },
          tick: function(){
              foo();
          },
      }
  );
  //...
}
//f2.js
function foo(){
  AFRAME.log("hello",'c1')
}
export default foo

In firefox browsers if i don't use vr It works, but with vr glasses doesn't work. In vr, the object is not created. When I don't use type="module" and I'm codding in a single script, it's works (the problem is not with the logs but with the objects that are not "created")

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