PERF: Update node_options during ember build for low end servers (#24850)

See https://meta.discourse.org/t/286643/14

Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
Rafael dos Santos Silva 2023-12-12 14:05:20 -03:00 committed by GitHub
parent 95c61b88dc
commit de936f07e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -22,14 +22,9 @@ task "assets:precompile:build" do
heap_size_limit = check_node_heap_size_limit
if heap_size_limit < 1024
STDERR.puts "Node.js heap_size_limit (#{heap_size_limit}) is less than 1024MB. Setting --max-old-space-size=1024."
compile_command = "NODE_OPTIONS='--max-old-space-size=1024' #{compile_command}"
end
if heap_size_limit < 2048
STDERR.puts "Node.js heap_size_limit (#{heap_size_limit}) is less than 2048MB. Disabling Webpack parallelization with JOBS=0 to conserve memory."
compile_command = "JOBS=0 #{compile_command}"
STDERR.puts "Node.js heap_size_limit (#{heap_size_limit}) is less than 2048MB. Setting --max-old-space-size=2048."
compile_command = "NODE_OPTIONS='--max-old-space-size=2048' #{compile_command}"
end
compile_command = "EMBER_ENV=production #{compile_command}" if ENV["EMBER_ENV"].nil?