Webpacker allows you to skip compilation in the assets:precompile task if WEBPACKER_PRECOMPILE is set to false (rails/webpacker#1023). However, React on Rails will still run build_production_command.
Right now, we can manually workaround this like so:
ReactOnRails.configure do |config|
# Copied from https://github.com/rails/webpacker/blob/7ed1c08e79c17680636fa99e6bb095ec1fbc8008/lib/tasks/webpacker/compile.rake#L36-L37
skip_webpacker_precompile = %w[no false n f].include?(ENV["WEBPACKER_PRECOMPILE"])
# This configures the script to run to build the production assets by webpack. Set this to nil
# if you don't want react_on_rails building this file for you.
unless skip_webpacker_precompile
config.build_production_command = "RAILS_ENV=production bin/webpack"
end
end
But it would be great if React on Rails natively supported this for feature parity 👍🏻
Webpacker allows you to skip compilation in the
assets:precompiletask ifWEBPACKER_PRECOMPILEis set tofalse(rails/webpacker#1023). However, React on Rails will still runbuild_production_command.Right now, we can manually workaround this like so:
But it would be great if React on Rails natively supported this for feature parity 👍🏻