Skip to content

Doctor false positives for apps with non-root JS workspace and custom webpack path #2606

@justin808

Description

@justin808

Summary

react_on_rails:doctor can report false positives in apps where JavaScript dependencies live outside repo root (for example client/package.json) and webpack config is not at config/webpack/webpack.config.js.

What happens

Doctor reports errors/warnings like:

  • missing react-on-rails-pro / React deps in package.json
  • missing webpack config at config/webpack/webpack.config.js

...even when the app is correctly configured and running with Shakapacker + React on Rails Pro.

Root cause

Several checks are hardcoded to root paths:

  • package.json
  • config/webpack/webpack.config.js

Relevant code paths in 16.4.0.rc.9:

  • lib/react_on_rails/system_checker.rb (check_react_on_rails_npm_package, check_react_dependencies, check_webpack_configuration)
  • lib/react_on_rails/doctor.rb (check_key_configuration_files, check_npm_package_version, check_pro_package_consistency, etc.)

Expected behavior

Doctor should either:

  1. Discover paths from app config (for example Shakapacker root/config), or
  2. Treat these checks as non-critical heuristics when path assumptions don't match, with clear messaging.

Suggested approach

  • Resolve package path from Shakapacker/React on Rails configuration when available.
  • Avoid hard-failing on config/webpack/webpack.config.js for custom/legacy setups.
  • Report assumptions explicitly in output when falling back to root paths.

Why this matters

In mature/legacy repos with custom layout, current Doctor output can look like critical misconfiguration when setup is actually valid, reducing trust in diagnostics.

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