Is it true webpack5 is unable to polyfill libraries? What are some solutions?

My problem was: I was using require in a js script used in the browser (to download nodemailer). Following the advice of this SO post, I downloaded browserify. It allowed me to use require in a js file used by the browser.

Webpack was another alternative listed. It is more common than browserify & has more features (like intelligently arranging files that import & export (from one another)).

However, it looks like webpack either doesn’t like require or nodemailer. Here is my error code when I try to make my bundle.js file:

enter image description here

My question is:

  • Is my summation of my problems, and my steps to solve them, reasonable?
  • If so, what are some common solutions people’re using?
%d bloggers like this: