DevOps has requested that we limit our frontend builds to ~1GB of RAM, so that our Jenkins instance doesn't shut down. We use a standard @vue/cli
project, with TypeScript. However, the TS type checking service ignores all attempts to limit its memory usage, which is always 2048 MB.
I've tried disabling it and relying on fork-ts-checker-webpack-plugin
but that introduces other problems.
Based on what I found, this should work:
$ NODE_OPTIONS=--max_old_space_size=1024 \
NODE_ENV=production \
node \
--max_old_space_size=1024 \
--max-old-space-size=1024 \
node_modules/.bin/vue-cli-service build
Note that I've no idea how these memory limits work, as I have limited awareness of Node's internals. But despite these, the type checking service always starts with a 2048 MB limit.
I'm not sure if it's a problem specific to how Vue CLI configures Webpack/TS.