Sha256: 84e2e8deeedda9c9fcdb9e594d3d4be495a8ea13151263f6127ce185dcb4b49b

Contents?: true

Size: 1.83 KB

Versions: 8

Compression:

Stored size: 1.83 KB

Contents

# Optional Configuration

Create a file `config/react_on_rails.rb` to override any defaults (this file is automatically created for you when using the generator). If you don't specify this file, the default options are below.

The `server_bundle_js_file` must correspond to the bundle you want to use for server rendering.

```ruby
# Shown below are the defaults for configuration
ReactOnRails.configure do |config|
  # Client bundles are configured in application.js
  # Server bundle is a single file for all server rendering of components.
  # Set the server_bundle_js_file to "" if you know that you will not be server rendering.
  config.server_bundle_js_file = "app/assets/javascripts/generated/server.js" # This is the default

  # Below options can be overriden by passing to the helper method.
  config.prerender = false # default is false
  config.generator_function = false # default is false, meaning that you expose ReactComponents directly
  config.trace = Rails.env.development? # default is true for development, off otherwise

  # For server rendering. This can be set to false so that server side messages are discarded.
  config.replay_console = true # Default is true. Be cautious about turning this off.
  config.logging_on_server = true # Default is true. Logs server rendering messags to Rails.logger.info

  # Settings for the pool of renderers:
  config.server_renderer_pool_size  ||= 1  # ExecJS doesn't allow more than one on MRI
  config.server_renderer_timeout    ||= 20 # seconds
end
```

You can configure your pool of JS virtual machines and specify where it should load code:

- On MRI, use `therubyracer` for the best performance (see [discussion](https://github.com/reactjs/react-rails/pull/290))
- On MRI, you'll get a deadlock with `pool_size` > 1
- If you're using JRuby, you can increase `pool_size` to have real multi-threaded rendering.

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
react_on_rails-1.2.2 docs/additional_reading/optional_configuration.md
react_on_rails-1.2.1 docs/additional_reading/optional_configuration.md
react_on_rails-1.2.0 docs/additional_reading/optional_configuration.md
react_on_rails-1.2.0.rc1 docs/additional_reading/optional_configuration.md
react_on_rails-1.1.1 docs/additional_reading/optional_configuration.md
react_on_rails-1.1.0 docs/additional_reading/optional_configuration.md
react_on_rails-1.0.3 docs/additional_reading/optional_configuration.md
react_on_rails-1.0.2 docs/additional_reading/optional_configuration.md