I am trying to add instagram feed to my next.js app, so I installed instagram-web-api, but when I do import Instagram from "instagram-web-api", it gives me a lot of errors(Can't resolve 'tls', Can't resolve 'fs', etc).
I can use other library just fine with npm install & import, but I am not sure why "instagram-web-api" giving me all this errors.
So I searched on internet for solution and saw feedback to add the below code to the next.config.js.
module.exports = { webpack5: true,
webpack: (config) => {
config.resolve.fallback = { tls: false };
return config;
},
};
So, I replaced module.exports = nextConfig; with this code, deleted and reinstalled the library again, then it gives me another bunch of errors (Can't resolve 'stream', Can't resolve 'buffer', Can't resolve 'process', Can't resolve 'cypto', etc).
I don't have a lot of knowledge on webpack, I'm used to using just the default setting of next.js, so I am not sure what's going on :(