13

I'm running Jenkins on a Fedora Virtual Machine and have an app created by create-react-app .

When I try to build for production on my local machine, after ~8 minutes, it does get compiled successfully (although with the message: 'the bundle size is significantly larger than recommended...'

However, when I run the same script during my Jenkins build process, I get the following error: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory.

The build script is as follows: npm run build-css && node --max_old_space_size=8192 node_modules/.bin/react-scripts-ts build && npm run copy-to-build.

My question is, how can I allocate more memory for my Virtual Machine running on Fedora so the script can run successfully before throwing the FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory .

Ray Kim
  • 1,931
  • 1
  • 13
  • 25

1 Answers1

6

The solution for me was to set GENERATE_SOURCEMAP=false in the .env.production file as described here.

A better solution (although more time consuming) is code split the huge files ( >1MB)

dropbear
  • 1,510
  • 1
  • 12
  • 21
Ray Kim
  • 1,931
  • 1
  • 13
  • 25