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

12345678910
  1. #!/usr/bin/env sh
  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*}" = "$NODE_OPTIONS" ]; then
  6. export NODE_OPTIONS="${NODE_OPTIONS} --max-old-space-size=8192"
  7. fi