diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index 24eac30fda3..68b5db61ac5 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -14,11 +14,15 @@ task 'assets:precompile:before' do end if EMBER_CLI && !(ENV["EMBER_CLI_COMPILE_DONE"] == "1") - # Using exec to free up Rails app memory during ember build - exec <<~SH - NODE_OPTIONS='--max-old-space-size=2048' yarn --cwd app/assets/javascripts/discourse run ember build -prod && \ - EMBER_CLI_COMPILE_DONE=1 bin/rake assets:precompile - SH + compile_command = "NODE_OPTIONS='--max-old-space-size=2048' yarn --cwd app/assets/javascripts/discourse run ember build -prod" + only_assets_precompile_remaining = (ARGV.last == "assets:precompile") + + if only_assets_precompile_remaining + # Using exec to free up Rails app memory during ember build + exec "#{compile_command} && EMBER_CLI_COMPILE_DONE=1 bin/rake assets:precompile" + else + system compile_command + end end # Ensure we ALWAYS do a clean build