Closed sammdec closed 3 years ago
Thanks for the issue @sammdec.
We actually ran into this on our app. It appears next js does something weird tree shaking. I am by no means a wizard at next js so maybe @ethandaya can comment more.
In the meantime you should be able to add this to your next.config.js
to fix the fs
resolution issues.
module.exports = {
webpack: (config, { isServer }) => {
// Fixes npm packages that depend on `fs` module
if (!isServer) {
config.node = {
fs: 'empty',
}
}
return config
},
}
I’m trying to use the sdk in my next.is app but when importing any function I get an error that fs is undefined or couldn’t be found.
This might be a next.js specific issue as it compiles on the server then attempts to compile on the client.
Is there a resolution?