airdcpp-web / airdcpp-apisocket-js

Javascript connector for AirDC++ Web API
7 stars 0 forks source link

Uncaught ReferenceError: process is not defined #17

Closed rishighan closed 3 years ago

rishighan commented 3 years ago

Is there any prerequisite to making Websocket work in the browser with airdcpp-socket? Specifically, I am looking at https://github.com/airdcpp-web/airdcpp-webui/blob/master/src/services/SocketService.ts#L28

To begin with, I have the exact same implementation, but I keep getting Webpack errors: Uncaught ReferenceError: process is not defined I understand that this is a node related error, but what gives?

maksis commented 3 years ago

I wonder if it's related to this line: https://github.com/airdcpp-web/airdcpp-apisocket-js/blob/4c4ba2139273268e683a3256dab8211dd60e8efe/src/SocketLogger.ts#L23

Could you try installing the node typings for your project to see if it fixes the error?

maksis commented 3 years ago

Or maybe it works with the Web UI because of https://github.com/airdcpp-web/airdcpp-webui/blob/5438e00a00dc220ed05c8912f4a05f20bff641b2/webpack.config.js#L48-L54

You could also try removing all references to process from the airdcpp-apisocket library that gets included in your project (dist/dist-es, file SocketLogger.js) if you don't want to try something similar

rishighan commented 3 years ago

That was it! Damn you are fast! I imagine removing references to process should be okay for now.

maksis commented 3 years ago

I'd say that this is something that needs fixing....

rishighan commented 3 years ago

I'm puzzled as to why you need to check for process vars in the browser, given that the web-ui would always run in the browser, right?

That said, what do you suggest I do? Fork and remove the check?

maksis commented 3 years ago

That said, what do you suggest I do? Fork and remove the check?

Use any workaround that works until a fixed version is available

maksis commented 3 years ago

This should be fixed in version 2.4.2