xDimGG / node-steamapi

An object-oriented Steam API wrapper for Node.js developers.
https://www.npmjs.com/package/steamapi
177 stars 43 forks source link

Update imports in fetch.js to use Webpack 5 compatiable polyfills #37

Closed mgscuteri closed 10 months ago

mgscuteri commented 2 years ago

Webpack 5 no longer automatically adds polyfills for the following imports in fetch.js

const { createDeflate, createGunzip } = require('zlib');
const { parse } = require('url');
const https = require('https');
const http = require('http');

This makes life very difficult for angular 13+

I think all that is needed is to run:

npm install browserify-zlib
npm install stream-http
npm install https-browserify
npm install url

and then update the imports in fetch.js to:

const { createDeflate, createGunzip } = require('browserify-zlib');
const { parse } = require('url');
const https = require('https-browserify');
const http = require('stream-http');
mgscuteri commented 2 years ago

The suggested solution does not work. Removing fetch entirely, and replacing it with axios does work.

mgscuteri commented 2 years ago

For anyone having issues with webpack 5, zlib, https, http, https-browserify or stream-http, see this fork may be helpful. https://github.com/mgscuteri/node-steamapi-webpack-5/blob/master/README.md

xDimGG commented 1 year ago

I may update the package to use a build system. This wasn't really built with browser support in mind, though, since the Steam API has CORS. Can you tell me what your use case is exactly or if you're just using some proxy?

xDimGG commented 10 months ago

Closing as stale. This may have already been resolved by the switch to node-fetch.