diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index cd0a3bd2bbe51bcde5cf6cdab076c52c203be6be..ad7c6ba9009ee973326dcda4d2426c2a57c7b3eb 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -1,8 +1,17 @@
 # frozen_string_literal: true
 
-if Rake::Task.task_defined?('assets:precompile')
-  Rake::Task['assets:precompile'].enhance do
+namespace :assets do
+  desc 'Generate 500.html'
+  task :generate_500 do
     html = ApplicationController.render('errors/500', layout: 'error')
     File.write(Rails.root.join('public', '500.html'), html)
   end
 end
+
+if Rake::Task.task_defined?('assets:precompile')
+  Rake::Task['assets:precompile'].enhance do
+    Webpacker::Manifest.load
+
+    Rake::Task['assets:generate_500'].invoke
+  end
+end