https://github.com/flolu/bazel-socketio-issue
The ts_devserver doesn't seem to work with socket.io-client out of the box: Uncaught TypeError: XMLHttpRequest is not a constructor
https://github.com/flolu/bazel-socketio-issue
angular bazel socketio typescript
Last synced: about 2 months ago
JSON representation
The ts_devserver doesn't seem to work with socket.io-client out of the box: Uncaught TypeError: XMLHttpRequest is not a constructor
- Host: GitHub
- URL: https://github.com/flolu/bazel-socketio-issue
- Owner: flolu
- Created: 2020-04-25T08:18:58.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T14:18:08.000Z (over 3 years ago)
- Last Synced: 2025-11-20T14:33:25.926Z (7 months ago)
- Topics: angular, bazel, socketio, typescript
- Language: Starlark
- Size: 435 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SocketIO Issue With Bazel + Angular
The `ts_devserver` doesn't seem to work with `socket.io-client` out of the box
## Setup
```
yarn install
```
## What Works
```
yarn prod
```
SocketIO works perfectly fine, server runs on http://localhost:8080
## The Issue
```
yarn dev
```
Results in this error in the Browser console (http://localhost:4200).
```
Uncaught TypeError: XMLHttpRequest is not a constructor
at ts_scripts.js?v=1587802098203:16776
at Object.23.../transport (ts_scripts.js?v=1587802098203:16780)
at o (ts_scripts.js?v=1587802098203:11783)
at ts_scripts.js?v=1587802098203:11783
at Object.22../polling (ts_scripts.js?v=1587802098203:16326)
at o (ts_scripts.js?v=1587802098203:11783)
at ts_scripts.js?v=1587802098203:11783
at Object.20../polling-jsonp (ts_scripts.js?v=1587802098203:16035)
at o (ts_scripts.js?v=1587802098203:11783)
at ts_scripts.js?v=1587802098203:11783
```
It is caused by [xmlhttprequest-ssl](https://www.npmjs.com/package/xmlhttprequest-ssl) which is a dependency of [engine.io-client](https://github.com/socketio/engine.io-client/blob/master/package.json) and it is needed by [ngx-socket-io](https://www.npmjs.com/package/ngx-socket-io)