microsoft / typed-rest-client

Node Rest and Http Clients with typings for use with TypeScript
Other
675 stars 118 forks source link

Browser Support #152

Closed darkdoctor closed 5 years ago

darkdoctor commented 5 years ago

Hi.

Does this library support browsers, or only node js apps? I am trying to compile it on angular but failing. 'fs' is missing from the 'Tunnel' lib.

bryanmacfarlane commented 5 years ago

We should fix this and possibly add s sample

darkdoctor commented 5 years ago

We should fix this and possibly add s sample

So, the current version is not supported for Angular?

bryanmacfarlane commented 5 years ago

Browsers are supported but this looks like a bug. Adding a sample would ensure it works in angular and doesn't regress going forward.

darkdoctor commented 5 years ago

ERROR in ./node_modules/typed-rest-client/HttpClient.js Module not found: Error: Can't resolve 'fs' in 'C:\Projekte\AngularLibrarys\eceg\node_modules\typed-rest-client' ERROR in ./node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'http' in 'C:\Projekte\AngularLibrarys\eceg\node_modules\tunnel\lib' ERROR in ./node_modules/typed-rest-client/HttpClient.js Module not found: Error: Can't resolve 'http' in 'C:\Projekte\AngularLibrarys\eceg\node_modules\typed-rest-client' ERROR in ./node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'https' in 'C:\Projekte\AngularLibrarys\eceg\node_modules\tunnel\lib' ERROR in ./node_modules/typed-rest-client/HttpClient.js Module not found: Error: Can't resolve 'https' in 'C:\Projekte\AngularLibrarys\eceg\node_modules\typed-rest-client' ERROR in ./node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'net' in 'C:\Projekte\AngularLibrarys\eceg\node_modules\tunnel\lib' ERROR in ./node_modules/typed-rest-client/Util.js Module not found: Error: Can't resolve 'path' in 'C:\Projekte\AngularLibrarys\eceg\node_modules\typed-rest-client' ERROR in ./node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'tls' in 'C:\Projekte\AngularLibrarys\eceg\node_modules\tunnel\lib' i 「wdm」: Failed to compile.

damccorm commented 5 years ago

Browsers are supported but this looks like a bug

Not sure if this is actually a regression - none of the stuff surrounding tunnel or fs has been touched in a long time, guessing that people have probably just been using webpack to get around it. Should be a pretty simple fix to allow us to not need to do that though.

darkdoctor commented 5 years ago

Browsers are supported but this looks like a bug

Not sure if this is actually a regression - none of the stuff surrounding tunnel or fs has been touched in a long time, guessing that people have probably just been using webpack to get around it. Should be a pretty simple fix to allow us to not need to do that though.

Webpack is not included anymore within the box of Angular 8, unfortunately.

bryanmacfarlane commented 5 years ago

Let's fix to not need it in the browser

quaos commented 2 years ago

Hi. Tried from different pc and a simple Angular Project.

ERROR in D:/Work/Web/demo/node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'assert' in 'D:\Work\Web\demo\node_modules\tunnel\lib' ERROR in D:/Work/Web/demo/node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'events' in 'D:\Work\Web\demo\node_modules\tunnel\lib' ERROR in D:/Work/Web/demo/node_modules/typed-rest-client/HttpClient.js Module not found: Error: Can't resolve 'fs' in 'D:\Work\Web\demo\node_modules\typed-rest-client' ERROR in D:/Work/Web/demo/node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'http' in 'D:\Work\Web\demo\node_modules\tunnel\lib' ERROR in D:/Work/Web/demo/node_modules/typed-rest-client/HttpClient.js Module not found: Error: Can't resolve 'http' in 'D:\Work\Web\demo\node_modules\typed-rest-client' ERROR in D:/Work/Web/demo/node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'https' in 'D:\Work\Web\demo\node_modules\tunnel\lib' ERROR in D:/Work/Web/demo/node_modules/typed-rest-client/HttpClient.js Module not found: Error: Can't resolve 'https' in 'D:\Work\Web\demo\node_modules\typed-rest-client' ERROR in D:/Work/Web/demo/node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'net' in 'D:\Work\Web\demo\node_modules\tunnel\lib' ERROR in D:/Work/Web/demo/node_modules/typed-rest-client/Util.js Module not found: Error: Can't resolve 'path' in 'D:\Work\Web\demo\node_modules\typed-rest-client' ERROR in D:/Work/Web/demo/node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'tls' in 'D:\Work\Web\demo\node_modules\tunnel\lib' ERROR in D:/Work/Web/demo/node_modules/typed-rest-client/HttpClient.js Module not found: Error: Can't resolve 'url' in 'D:\Work\Web\demo\node_modules\typed-rest-client' ERROR in D:/Work/Web/demo/node_modules/typed-rest-client/Util.js Module not found: Error: Can't resolve 'url' in 'D:\Work\Web\demo\node_modules\typed-rest-client' ERROR in D:/Work/Web/demo/node_modules/tunnel/lib/tunnel.js Module not found: Error: Can't resolve 'util' in 'D:\Work\Web\demo\node_modules\tunnel\lib'

I also got this in React app created using create-react-app with cra-typescript template. Using yarn, without any custom webpack config. 😢