not-an-aardvark / snoowrap

A JavaScript wrapper for the reddit API
MIT License
1.01k stars 125 forks source link

Cannot resolve dependencies in webpack 5 #350

Open codelocksdev opened 2 years ago

codelocksdev commented 2 years ago

When I try to add this dependency to a web app (made with create-react-app) using webpack 5, I get errors saying that it will not polyfill the node dependencies (url and streams). Is this library not meant to be used in a front end? Can you please update the code/dependencies to work in a browser and with webpack 5?

iMrDJAi commented 2 years ago

As far as I remember, you have to add this to your Webpack config:

node: {
    fs: 'empty',
    net: 'empty',
    tls: 'empty',
    // put any other node builtins here
}