1

I have a normal react setup, without CRA, which means I manually configured webpack and babel etc... I currently have 2 scripts which run webpack : package.json :

  "scripts": {
    "dev": "NODE_OPTIONS='--openssl-legacy-provider --max-old-space-size=8000' webpack --watch --config webpack.dev.js",
    "prod": "NODE_OPTIONS='--openssl-legacy-provider' webpack --config webpack.prod.js"
  },

when I run npm run prod, the issue does not happen and all the assets get compiled like normal. However, when i run npm run dev, after working for a while (less than an hour), the terminal kills webpack and shows the following:

enter image description here

I'm not sure what is happening here but I saw some recommendations to circumvent the issue by adding --max-old-space-size=8000 to the NODE_OPTIONS in the script.

However the issue persists. Any idea How to deal with it ?

coderdonezo
  • 399
  • 1
  • 12
  • Open Activity Monitor (if on Mac) or Task Manager (if on Windows), leave it open, and run webpack again. Search for the node process (usually there might be only one) and keep an eye on the memory consumption of that process while webpack runs. It might be that your application requires more than 8000 MB of RAM. – yorch Mar 15 '22 at 13:14
  • The server is remote unfortunately, so can't do that from where I am. – coderdonezo Mar 16 '22 at 11:33
  • 2
    seems like you have SSH / console access to it, so if it's linux, you can use `htop` / `top` on the command line – yorch Mar 16 '22 at 12:03
  • Oh great this basically lets me monitor everything Thank you ! I'll run `npm run dev` in a console window and `htop` in another and check back when webpack is killed. – coderdonezo Mar 16 '22 at 13:17

0 Answers0