[js/web] configure 5GB memory space for webpack build (#17684)

### Description
ort-web build step - webpack consumes the amount of memory on the edge
of Node.js(V8)'s default max-old-space-size, so increase the default
memory size to 5GB to avoid this issue.
This commit is contained in:
Yulong Wang 2023-09-25 09:22:00 -07:00 committed by GitHub
parent 216214b7d3
commit df15a3a335
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -176,7 +176,12 @@ npmlog.info('Build', 'Building bundle...');
webpackArgs.push('--env', `-f=${FILTER}`);
}
npmlog.info('Build.Bundle', `CMD: npx ${webpackArgs.join(' ')}`);
const webpack = spawnSync('npx', webpackArgs, {shell: true, stdio: 'inherit', cwd: ROOT_FOLDER});
const webpack = spawnSync('npx', webpackArgs, {
shell: true,
stdio: 'inherit',
cwd: ROOT_FOLDER,
env: {...process.env, NODE_OPTIONS: (process.env.NODE_OPTIONS ?? '') + ' --max-old-space-size=5120'}
});
if (webpack.status !== 0) {
console.error(webpack.error);
process.exit(webpack.status === null ? undefined : webpack.status);