set-max-old-space-size.sh 324 B

12345678910
  1. #!/usr/bin/env bash
  2. # This script sets the node `--max-old-space-size` to 8192 if it is not set already.
  3. # All existing `NODE_OPTIONS` are retained as is.
  4. export NODE_OPTIONS="${NODE_OPTIONS:-}"
  5. if [[ $NODE_OPTIONS != *"--max-old-space-size"* ]]; then
  6. export NODE_OPTIONS="${NODE_OPTIONS} --max-old-space-size=8192"
  7. fi