Got an issue where a stompJS-lib was not found, upon which I got the following error message:
Module not found: Error: Can\'t resolve \'net\' in \'/../../../.../
To expand a bit on Arthur Costa answer, if you're using NextJS, you can add a configuration in your configuration file to prevent this issue for specific imports.
Add those lines in a file named next.config.js
in your root project folder:
module.exports = {
webpack: (config, { isServer }) => {
if (!isServer) {
config.node = {
net: 'empty'
};
}
return config;
}
}
In case the problem appears with other built-in modules, you can add those alongside net
too.
Source: https://github.com/vercel/next.js/issues/7755#issuecomment-508633125