Importing non-existant xmlhttprequest-ssl
rithvikvibhu opened this issue · comments
You want to:
- report a bug
Current behaviour
Fails importing xmlhttprequest-ssl.js as it doesn't exist.
Steps to reproduce (if the current behaviour is a bug)
It's on the master branch.
Expected behaviour
The file should exist.
Setup
- OS: Windows / Linux
- browser:
- engine.io version: latest master branch
Other information (e.g. stacktraces, related issues, suggestions how to fix)
https://github.com/socketio/engine.io-client/blob/master/lib/transports/index.js#L5
https://github.com/socketio/engine.io-client/blob/master/lib/transports/polling-xhr.js#L5
https://github.com/socketio/engine.io-client/blob/master/lib/transports/polling.js#L23
All 3 files require xmlhttprequest-ssl.js
which doesn't exist. Changing them to ../xmlhttprequest
works. I guess the ssl file is under development. This is a temporary fix.
This issue still exists in the current release. So I don't know why it has been closed...
@ramsestom could you please provide more details? xmlhttprequest-ssl
is listed as dependency here and the browser should use ./lib/xmlhttprequest.js
, defined there. Am I missing something?
I do not use engine.io-client in a browser (I use it in react-native) so this is probably not considered. Anyway, for me the correct file is in \node_modules\xmlhttprequest-ssl\lib\XMLHttpRequest.js and not directly in lib\XMLHttpRequest.js ...
So I don't know how you are supposed to make a requiere call of a dependency class but defining a static path (like lib/XMLHttpRequest.js ) is probably not the good way to do it....
@ramsestom I think you are misunderstanding:
xmlhttprequest-ssl is listed as dependency here: https://github.com/socketio/engine.io-client/blob/3.1.1/package.json#L36
So a node.js client would use the xmlhttprequest-ssl
package, which emulates the XMLHttpRequest object from the browser.
the browser should use ./lib/xmlhttprequest.js, defined there: https://github.com/socketio/engine.io-client/blob/3.1.1/package.json#L72
The browser field (spec) describes which files are to be used in the browser (client-side). Here, instead of using the xmlhttprequest-ssl
, it points towards the file https://github.com/socketio/engine.io-client/blob/master/lib/xmlhttprequest.js.
So I still think the issue is in react-native (and that may be related: facebook/react-native#9854)
OK. I removed the The browser field from the package.json package and the react-narive packager is now able to correctly find the ssl-xmlhttprequest package and class. This now fail because XMLLHttpRequest.js from ssl-xmlhttprequest is using core node modules (like fs) that react-native doesn't have. So, for now, I will stick to using the xmlhttprequest class embeded into the engine.io source (and completely remove the ssl-xmlhttprequest dependency)