Aframe: Compatibility with node

Created on 31 Oct 2016  路  5Comments  路  Source: aframevr/aframe

Description:

  • A-Frame Version: 0.3.2
  • Platform/Device: node.js

I wanted to make an aframe demo with react using next.js doing isomorphic rendering. Importing aframe won't work since node does not recognize the window global.

It would be great to adapt aframe to work with node so it can be used on isomorphic apps

feature request

Most helpful comment

2484 should get you almost all the way there.

All 5 comments

Workaround might be to do a super stub of the window with global.window = { ... }.

aframe-react actually only needs AFRAME.components, so yeah, need to find a way to decouple for Node purposes.

Solution might be to have a browser.js entry point and a separate index.js entry point which contains Node-friendly requires. The browser.js entry point can export what index.js does. Point package.json main to index.js and package.json browser field to whatever is in dist/.

@ngokevin @impronunciable I have created a repo https://github.com/ltfschoen/react-fluxible-test that shows how to incorporate A-Frame React into a Fluxible app (i.e. uses isomorphic architecture with server-side rendering)

2484 should get you almost all the way there.

2484

Was this page helpful?
0 / 5 - 0 ratings