react_on_rails.rb 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # frozen_string_literal: true
  2. # See https://github.com/shakacode/react_on_rails/blob/master/docs/basics/configuration.md
  3. # for many more options.
  4. ReactOnRails.configure do |config|
  5. # This configures the script to run to build the production assets by webpack. Set this to nil
  6. # if you don't want react_on_rails building this file for you.
  7. config.build_production_command = "RAILS_ENV=production NODE_ENV=production bin/webpack"
  8. ################################################################################
  9. ################################################################################
  10. # TEST CONFIGURATION OPTIONS
  11. # Below options are used with the use of this test helper:
  12. # ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
  13. ################################################################################
  14. # If you are using this in your spec_helper.rb (or rails_helper.rb):
  15. #
  16. # ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
  17. #
  18. # with rspec then this controls what yarn command is run
  19. # to automatically refresh your webpack assets on every test run.
  20. #
  21. config.build_test_command = "RAILS_ENV=test bin/webpack"
  22. ################################################################################
  23. ################################################################################
  24. # SERVER RENDERING OPTIONS
  25. ################################################################################
  26. # This is the file used for server rendering of React when using `(prerender: true)`
  27. # If you are never using server rendering, you should set this to "".
  28. # Note, there is only one server bundle, unlike JavaScript where you want to minimize the size
  29. # of the JS sent to the client. For the server rendering, React on Rails creates a pool of
  30. # JavaScript execution instances which should handle any component requested.
  31. #
  32. # While you may configure this to be the same as your client bundle file, this file is typically
  33. # different. You should have ONE server bundle which can create all of your server rendered
  34. # React components.
  35. #
  36. config.server_bundle_js_file = "react-bundle.js"
  37. end