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
Tag: webpack-4
How to dynamically import SVG and render it inline
I have a function that takes some arguments and renders an SVG. I want to dynamically import that svg based on the name passed to the function. It looks like this: According to the webpack documentation for dynamic imports and the magic comment “eager”: “Generates no extra chunk. All modules are included in the current chunk and no additional network
Babel not compiling vendors chuck
I migrated to Webpack 4 and set up everything according to the Docs, however, my vendors.js chunk is not getting compiled like the main.js chunk. I have placed the vendors into the optimization.splitChunks.cacheGroups object, as the docs suggested, but didnt find a way to make these “cacheGroups” get compiled with babel. My problem is that one of the libraries has