-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
area-signalrIncludes: SignalR clients and serversIncludes: SignalR clients and servers
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Hi,
I'm using the npm package @microsoft/signalr with version 7.0.4. I'm using esbuild for bundeling, however, it does not correctly resolve some dependencies, like ws.
This is due those hacks:
// 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");I don't think this is an issue of esbuild, since it believes that this is a dynamic require. Can we somehow fix this?
I confirmed that this is the issue, by patching the lib to use plain require instead of the requireFunc, then everything works correctly.
Expected Behavior
ws is resolved correctly when using the bundle option of esbuild.
Steps To Reproduce
https://github.com/hrueger/signalr-esbuild-issue
yarn installyarn build- See
__webpack_require__is still indist/bundle.jsinstead of thewsmodule embedded in the bundle.
Exceptions (if any)
No response
.NET Version
n/a
Anything else?
No response
nulladdict, BenShelton, bigcakes, Kahbazi, nima-ap and 2 more
Metadata
Metadata
Assignees
Labels
area-signalrIncludes: SignalR clients and serversIncludes: SignalR clients and servers