airdcpp-web/airdcpp-apisocket-js

Uncaught ReferenceError: process is not defined

Closed this issue · 7 comments

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?

I wonder if it's related to this line:

const allowFormatArgs = !isBrowser || (process && process.env && process.env.NODE_ENV === 'test');

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

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

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

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

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?

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

Use any workaround that works until a fixed version is available

This should be fixed in version 2.4.2