Skip to content

Commit

Permalink
[js/web] configure 5GB memory space for webpack build (microsoft#17684)
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
fs-eire authored Sep 25, 2023
1 parent 4ca0e95 commit 9220b2a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion web/script/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9220b2a

Please sign in to comment.