#!/bin/bash

yarn build

# Run the a PRODUCTION build of the [nextjs] application.
# 
# NOTE:
#     `--max-old-space-size` prevents a "heap out of memory" error when compiling the client.
#     Fix found here: https://github.com/Chatie/wechaty/issues/1435
# 
export NODE_ENV=production && node \
  --max-old-space-size=4096 \
 ./node_modules/next/dist/bin/next-build \
 ./lib
