Posts

Showing posts from January, 2022

Resolving the Webpack Polyfills Breaking Change When Upgrading an Angular App

While working on upgrading an Angular application, which is several versions behind, to the latest version, I encountered the following error during build: 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: { "util": require.resolve("util/") }' - install 'util' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "util": false } This was happening because one of the developers imported isNullOrUndefined  from util  in two components. I did some Googling, and found a few issues on GitHub, which included some various workarounds, and strangely enough, became heated  -- people were expressing hostility  over this issue, and the factors around it. But amidst all the chaos, one p