Skip to content

Installer generates shakapacker.yml with compile: true in development causing 'Slow setup' warnings #1850

@justin808

Description

@justin808

Problem

The React on Rails installer is generating config/shakapacker.yml with incorrect compile settings, causing unnecessary "Slow setup for development" warnings when using Procfiles with bin/dev.

Current Behavior

The generated shakapacker.yml has:

development:
  <<: *default
  compile: true  # ❌ Wrong - causes on-demand compilation

This causes Rails to attempt on-demand asset compilation even when bin/shakapacker-dev-server or bin/shakapacker --watch are running via Procfiles, resulting in this warning on every request:

Shakapacker::Compiler - Slow setup for development

Prepare JS assets with either:
1. Running bin/shakapacker-dev-server
2. Set compile to false in shakapacker.yml and run bin/shakapacker -w

Expected Behavior

The correct configuration should be:

default: &default
  # ... other settings ...
  compile: false  # Default is false (use Procfiles)

development:
  <<: *default
  # Inherits compile: false - no on-demand compilation

test:
  <<: *default
  compile: true  # Only tests need on-demand compilation

production:
  <<: *default
  compile: false  # Assets are precompiled

Impact

  • Developers see unnecessary warnings on every page load
  • Confusion about whether the dev server is working correctly
  • Potential performance impact from Rails attempting compilation checks

Environment

  • React on Rails: 16.1.1
  • Shakapacker: 9.x (from GitHub main)
  • Rails: 8.0.3

Suggested Fix

Update the installer template for shakapacker.yml to:

  1. Set compile: false in the default section
  2. Remove compile: true from development section (let it inherit)
  3. Keep compile: true only in test section

Related Files

This appears to affect the installer generator template, likely in:

  • lib/generators/react_on_rails/install/templates/base/config/shakapacker.yml

Reproduction

  1. Run react_on_rails installer to create a new demo
  2. Run bin/dev (which starts rails server + shakapacker-dev-server)
  3. Visit any page
  4. Observe "Slow setup for development" warning in logs

References

Found while working on: shakacode/react_on_rails-demos#20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions