Javascript heap out of memory during deploy?

During deployment we see:

Build failed with error: Project build failed
Error: Next.js build failed. This is most likely due to an error in your application code and not a problem with the XDN.

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory`

Looks like the build server is running out of memory, this message:
Build failed with error: Project build failed tells you that the build failed before interacting with the XDN

You can use NODE_OPTIONS to increase the limit globally ex.
export NODE_OPTIONS=--max_old_space_size=4096