aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.69k stars 3.98k forks source link

Use of "node.process" and avoiding polyfills #4881

Open camelgod opened 3 years ago

camelgod commented 3 years ago

Description:

Excuse me if I'm off track. I am upgrading my AFrame project from Webpack4 to Webpack5, however, Webpack5 removes polyfill for node modules including node.process, which is used a couple of places in the aframe code, for example

https://github.com/aframevr/aframe/blob/f029cfa187c086863ebcd863d50282e1f4833bec/src/utils/device.js#L183 https://github.com/aframevr/aframe/blob/f029cfa187c086863ebcd863d50282e1f4833bec/src/utils/debug.js#L90

This makes it so i have to polyfill support to continue using Aframe.

I've seen other projects and comments elsewhere mention that process.browser is unsafe or should not be used in frontend libraries, or libraries that have changed the check to for example if (typeof window !== "undefined"). I'm not sure about these claims and have little experience with Webpack/Node on this level.

Not sure if this applies to Aframe, but I wanted to raise the question here and see if someone has any thoughs about it.

dmarcos commented 3 years ago

Thanks. Happy to change it. Any docs on how is the recommended way to detect a node environment these days?

dmarcos commented 1 year ago

Any PR for this will be welcome