angularnpmwebpackpolyfills

Angular needing me to set polyfills because of Webpack 5


So, I was coding, and I ran ng serve. It gave me this error about polyfills:

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

I looked it up, and none of the fixes helped me. I tried configuring a webpack.config.js, adding a module to Angular polyfilling it, changing the builder (which gave me a ton of security risks in npm) and none of them worked. Oh, and ng build also didn't work.

Is there anything else I can do?

EDIT: Here's the verbose output. It's very long, so I put it in this pastebin.


Solution

  • So I figured it out.

    It was about some faulty node modules; the pg and node-postgres modules.