SignalR does not work in a VsCode extension

Viewed 34

I'm following the official docs to add signalR to my VsCode extension. My dependencies in the package.json are:

    "dependencies": {
        "@microsoft/signalr": "^6.0.8",
        "@taqueria/protocol": "^0.12.0",
        "cli-table3": "^0.6.2",
        "comment-json": "^4.1.1",
        "node-fetch": "^3.2.10",
        "promise-memoize": "^1.2.1",
        "rambda": "^7.0.1",
        "rxjs": "^7.5.6",
        "semver": "^7.3.7"
    }

But I get this error: requireFunc is not a function.

The offending code is:

        if (Platform.isNode && typeof require !== "undefined") {
            // In order to ignore the dynamic require in webpack builds we need to do this magic
            // @ts-ignore: TS doesn't know about these names
            const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
            webSocketModule = requireFunc("ws");
            eventSourceModule = requireFunc("eventsource");
        }

in node_modules/@microsoft/signalr/src/HttpConnection.ts

While debugging, it seems that all three variables __non_webpack_require__, __non_webpack_require__, and require are not defined.

0 Answers
Related