Description:
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
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)
Most helpful comment
2484 should get you almost all the way there.