Skip to content

docs: legacy Webpacker and migration-fit guidance (#3138)#3157

Merged
justin808 merged 11 commits intomainfrom
jg/3138-fix
Apr 23, 2026
Merged

docs: legacy Webpacker and migration-fit guidance (#3138)#3157
justin808 merged 11 commits intomainfrom
jg/3138-fix

Conversation

@justin808
Copy link
Copy Markdown
Member

@justin808 justin808 commented Apr 18, 2026

Summary

Adds explicit first-target guidance to the react-rails and vite_rails migration guides so teams pick a realistic migration slice and don't conclude "React on Rails is broken" when the real problem is legacy bundler compatibility.

What changed

  • docs/oss/migrating/migrating-from-react-rails.md
    • New Pick the right first target section that classifies apps into Shakapacker-baseline island mounts, Webpacker-era apps, and client-routed SPA shells.
    • New Preferred path for Webpacker-era apps section that recommends migrating webpackershakapacker as a separate PR before adding react_on_rails, and spells out the compatibility shims needed if a team intentionally stays on Webpack 4.
    • Updated the existing "Practical checklist for Webpacker-era apps" to cross-reference the new section.
  • docs/oss/migrating/migrating-from-vite-rails.md
    • New Two different starting points section that distinguishes Rails-owned island mounts (the happy path the existing guide is written for) from client-routed SPA shells (an architecture case study, not a quick first migration).

Why

From the issue: on apps like indentlabs/notebook, the current docs don't make it obvious that legacy bundler compatibility — not React on Rails itself — is the main friction. Similarly, SPA-root Vite apps look like easy targets but are architectural rewrites. These additions let readers self-classify before they start.

Validation

  • pnpm exec prettier --check on both changed docs files passes
  • Pre-commit hooks (trailing newlines, lychee markdown link check, prettier) all pass
  • Pre-push hooks (branch-lint, markdown-links) pass

Fixes #3138.

🤖 Generated with Claude Code


Note

Low Risk
Low risk: documentation-only updates that don’t affect runtime behavior, but they may change user guidance around supported bundler paths and recommended upgrade sequencing.

Overview
Adds upfront decision guidance to the react-rails and vite_rails migration docs so teams choose a realistic first migration slice.

For migrating-from-react-rails.md, it now explicitly classifies app shapes (island mounts vs Webpacker-era vs SPA shells), adds a preferred staged path for Webpacker-era apps (migrate webpackershakapacker first, then install React on Rails, with version-pin guidance), and updates existing preflight/checklists to point to this guidance.

For migrating-from-vite-rails.md, it distinguishes island-mount vs SPA-shell starting points and expands the Vite-specific replacement section with concrete guidance for migrating import.meta.glob usage to Webpack’s require.context (including sync vs lazy semantics).

Reviewed by Cursor Bugbot for commit 7fde5c2. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Documentation
    • Added migration decision guidance: classify apps as Rails-owned island mounts, Webpacker-era apps, or client-routed SPA shells.
    • Introduced a preferred staged path for Webpacker-era apps: migrate bundler first (separate PR), then run the React on Rails install; note option to pin react_on_rails < 16.0 and that current releases don’t install with webpacker.
    • Expanded Vite→React guidance, including replacing import.meta.glob and SPA vs island migration approaches.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 18, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds targeted migration guidance in two docs: react-rails classifies first-targets and mandates a separate Webpacker→Shakapacker PR before running the React on Rails generator; vite-rails distinguishes Rails-owned island mounts from client-routed SPA shells and documents Vite runtime differences (e.g., import.meta.glob replacement).

Changes

Cohort / File(s) Summary
React on Rails migration
docs/oss/migrating/migrating-from-react-rails.md
Added "Pick the right first target" classification; introduced "Preferred path for Webpacker-era apps" requiring a separate webpackershakapacker PR before running the React on Rails install generator; updated Preflight and checklist to reference the preferred path; noted react_on_rails can be pinned to < 16.0 and that current React on Rails does not install with gem "webpacker".
Vite Rails migration
docs/oss/migrating/migrating-from-vite-rails.md
Added "Two different starting points" splitting Rails-owned island mounts vs client-routed SPA shells; expanded SPA-shell migration shapes (single react_component render or island-splitting); added guidance on Vite runtime differences and a dedicated import.meta.globrequire.context replacement subsection highlighting semantic mismatches.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through docs with curious paws,

Labeled islands, bundlers, and migration laws.
Shakapacker first — one tidy PR to start,
SPA shells kept gentle, mapped part by part.
A carrot of guidance from my tiny heart.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: adding documentation about legacy Webpacker compatibility and migration guidance, which directly matches the core objectives of the PR.
Linked Issues check ✅ Passed The PR fully addresses all coding/documentation objectives from issue #3138: clarifies preferred Webpacker→Shakapacker migration path, provides compatibility guidance with fallback pins, distinguishes Rails-owned islands from SPA shells, and adds explicit migration-fit guidance to prevent misattribution of bundler issues to React on Rails.
Out of Scope Changes check ✅ Passed All changes are scoped to the two migration documentation files and directly support the objectives of clarifying migration paths and bundler compatibility, with no unrelated modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg/3138-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 18, 2026

Greptile Summary

This PR adds two documentation sections to the React on Rails migration guides: a "Pick the right first target" section in the react-rails migration guide (plus a "Preferred path for Webpacker-era apps" section and a cross-reference in the existing checklist), and a "Two different starting points" section in the vite_rails migration guide. The additions address a real gap: teams were concluding "React on Rails is broken" when the friction was actually legacy bundler incompatibility or an ill-chosen first migration target.

Confidence Score: 5/5

Documentation-only PR with no code changes; safe to merge.

All changes are prose additions to migration guides. Content is accurate, internally consistent, and addresses a genuine usability gap. No P0 or P1 findings.

No files require special attention.

Important Files Changed

Filename Overview
docs/oss/migrating/migrating-from-react-rails.md Adds "Pick the right first target" and "Preferred path for Webpacker-era apps" sections plus a cross-reference in the existing Webpacker checklist; content is accurate and consistent with the rest of the document.
docs/oss/migrating/migrating-from-vite-rails.md Adds "Two different starting points" section distinguishing island mounts from SPA shells; well-placed before Preflight and clearly scoped.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Start migration] --> B{Which bundler?}
    B -- Shakapacker 7+ & Rails 6+ --> C[Island mounts?]
    B -- gem webpacker / Webpack 4 --> D[Preferred path: migrate bundler first]
    D --> D1[PR 1: webpacker → shakapacker]
    D1 --> D2[PR 2: run react_on_rails generator]
    C -- Yes --> E[✅ Smoothest path - Run generator + follow steps]
    C -- No, SPA shell --> F[⚠️ Not a quick first migration - Pick a Rails-owned island first]
    F --> E
Loading

Reviews (1): Last reviewed commit: "docs: add legacy Webpacker and migration..." | Re-trigger Greptile

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ae10c0265

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 18, 2026

Review: docs/oss/migrating — Webpacker & SPA-shell guidance

This is a solid documentation improvement that solves a real user confusion. The two-level classification (island mounts vs SPA shells; Shakapacker-baseline vs Webpacker-era) is the right mental model to surface early, and the placement before Preflight is correct — readers need to self-classify before the how-to steps are useful.

What works well

  • "Pick the right first target" gives exactly the right early-exit signals.
  • Naming the misreadings explicitly ("teams conclude 'React on Rails is broken' when the real problem is legacy bundler compatibility") is unusually direct and useful.
  • The migrating-from-vite-rails.md SPA-shell warning is clear and appropriately firm.
  • Internal cross-references between "Preferred path" and the bottom checklist are correct.

Issues to address

1. Shakapacker version inconsistency (react-rails doc)

"Pick the right first target" names Shakapacker 7+ as the smooth path, but "Preferred path for Webpacker-era apps" later says "auto-detection assumes Shakapacker 9.0+". Both facts are true, but a reader who is on Shakapacker 8.x will be unsure whether they're on the smooth path or need the explicit server_bundle_output_path. Adding a short clarification — e.g. "Shakapacker 7+ is the general baseline; server_bundle_output_path auto-detection requires 9.0+" — would close that gap.

2. Missing link to Shakapacker migration guide

Step 1 of "Preferred path for Webpacker-era apps" recommends "Migrate to Shakapacker first, as its own PR" but doesn't link to the Shakapacker upgrade guide or the shakapacker gem's own changelog / migration notes. Readers will immediately want to know where to go. Even a note pointing to the Shakapacker repo or its upgrade docs would help.

3. Preflight is now partially redundant

After the new sections, the first item in Preflight ("if the app still uses webpacker, migrate to shakapacker first") repeats advice already given above in more detail. Consider replacing it with a short back-reference: "See Preferred path for Webpacker-era apps above." — this avoids the reader seeing the same instruction twice with no additional detail.

4. Minor: import.meta.glob in vite-rails doc

The new SPA-shell paragraph mentions import.meta.glob as a Vite-specific behavior with "no direct Shakapacker analogue". That's accurate, but the existing step 5 in the same file already tells readers how to replace import.meta.env via DefinePlugin/EnvironmentPlugin. A brief cross-reference from the new section to step 5 would connect the diagnosis to the remedy.

Verdict

Approve with minor suggestions. None of the issues above are blockers, but the version-number ambiguity (#1) is the most likely to create real confusion and is worth a one-line fix before merge.

Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
Comment thread docs/oss/migrating/migrating-from-vite-rails.md Outdated
Add explicit guidance in the react-rails and vite_rails migration docs so
teams pick a realistic first migration target:

- react-rails: new "Pick the right first target" and "Preferred path for
  Webpacker-era apps" sections. Recommend migrating webpacker to
  shakapacker as a separate PR before adding react_on_rails, and spell
  out the compatibility shims required if a team intentionally stays on
  Webpack 4.
- vite_rails: new "Two different starting points" section distinguishing
  Rails-owned island mounts from client-routed SPA shells. SPA shells
  should not be treated as a quick first migration.

Fixes #3138.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf8815a09a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 18, 2026

Code Review

This is a docs-only PR adding up-front migration-target classification to both migration guides. The changes are well-motivated and address a real usability problem (teams misdiagnosing RoR as broken when the root cause is legacy bundler incompatibility or an SPA-shell architecture choice).

Overall assessment

The three-way classification (island mounts / Webpacker-era / SPA shells) gives readers a clear self-triage framework. The guidance is accurate. A few minor observations:


1. Preflight item 1 is now orphaned from the new guidance

The existing Preflight checklist in migrating-from-react-rails.md already has:

Webpacker vs Shakapacker: if the app still uses webpacker, migrate to shakapacker first.

Now that there is a dedicated Preferred path for Webpacker-era apps section with richer guidance, the Preflight item should cross-reference it — otherwise readers who skim directly to Preflight miss the "in its own PR" emphasis and the shim list. Suggested update (easy one-liner):

1. **Webpacker vs Shakapacker**: if the app still uses `webpacker`, migrate to `shakapacker` first (see [Preferred path for Webpacker-era apps](#preferred-path-for-webpacker-era-apps)).

2. Intentional but notable content duplication

The four-bullet shim list in Preferred path for Webpacker-era apps (pinned webpack, babel config, webpack config edits, server_bundle_output_path) is essentially restated in prose at the end of Practical checklist for Webpacker-era apps. The duplication is harmless now but means two places to update if the shim list changes. Consider whether the checklist summary should link to the detail bullets instead of paraphrasing them.


3. import.meta.glob mention could name the webpack equivalent

The new Two different starting points section flags import.meta.glob as having "no direct Shakapacker analogue". That is accurate, but webpack's require.context() is the closest equivalent — naming it here saves readers a search and is consistent with the specificity the rest of that guide provides.


4. server_bundle_output_path example value is missing

The new Preferred path for Webpacker-era apps section lists server_bundle_output_path as a required explicit config but does not show a value. The existing Legacy compatibility fixes section further down shows "ssr-generated" as an example. Consider either pointing to that section or repeating the example value inline so a reader does not have to scroll to find it.


Minor nit

The phrase "architecture case study" appears verbatim in both guides. It reads slightly unusually for reference docs. "Architectural rewrite" or "significant architectural decision" might feel more natural — but this is purely stylistic.


No blocking issues. The structural improvements are net positive.

Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
Comment thread docs/oss/migrating/migrating-from-vite-rails.md Outdated
- Remove inaccurate claim that Webpacker-era apps can work with current
  React on Rails; `doctor.rb` flags Webpacker as a removed breaking
  change and the gemspec requires `shakapacker >= 6.0`.
- Clarify Shakapacker version expectations: 7+ baseline with a note
  that `server_bundle_output_path` auto-detection requires 9.0+.
- Link to the Shakapacker upgrade guide in the Preferred path.
- Replace Preflight step 1 with a back-reference to avoid duplicating
  the new Preferred path section.
- Note that `import.meta.glob` has no direct Webpack equivalent and
  must be replaced with explicit `require.context` calls.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@justin808
Copy link
Copy Markdown
Member Author

@coderabbitai Thanks — acknowledged that the automated review found no actionable items on the latest commit. Addressing minor suggestions from parallel reviews in 02b66cd.

@justin808
Copy link
Copy Markdown
Member Author

@greptile-apps Thanks for the confidence-5/5 read. No P0/P1 findings here, and the minor suggestions from parallel reviews (Shakapacker version callout, upgrade guide link, import.meta.glob note, Webpacker-supported claim) were addressed in 02b66cd.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 18, 2026

Tip

For best results, initiate chat on the files or code changes.

@justin808 Thanks for the update! Glad the latest commit is clean. The documentation additions look well-structured — the staged migration guidance (Webpacker → Shakapacker as a separate PR before adopting React on Rails) and the island-mount vs. SPA-shell distinction should meaningfully reduce friction for teams migrating from legacy setups. 🚀


🧠 Learnings used
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-21T08:53:17.309Z
Learning: For small, focused PRs (roughly 5 files or fewer with one clear purpose): use at most one AI reviewer for inline comments, batch review fixes into one follow-up push, and verify language/runtime/library claims locally before making code changes in response to AI review

Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-12T23:15:11.806Z
Learning: For small, focused PRs (5 files changed or fewer with one clear purpose): use at most one AI reviewer that leaves inline comments; additional AI tools should be summary-only or used manually

Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: react_on_rails_pro/CLAUDE.md:0-0
Timestamp: 2026-02-24T16:52:47.694Z
Learning: Applies to react_on_rails_pro/spec/dummy/commonWebpackConfig.js : Changes to `commonWebpackConfig.js` affect all three webpack bundles (client, server, and RSC) in the Pro dummy app

Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-12T23:15:11.806Z
Learning: Applies to CHANGELOG.md : Changelog format: `[PR 1818](https://github.com/shakacode/react_on_rails/pull/1818) by [username](https://github.com/username)` (no hash before PR number)

Learnt from: justin808
Repo: shakacode/react_on_rails PR: 2857
File: README.md:0-0
Timestamp: 2026-03-26T08:32:31.881Z
Learning: In `README.md` (and related docs) for `shakacode/react_on_rails`, the Ruby minimum version (`>= 3.0`) similarly reflects the actual package validator/gemspec floor, while `CI tested: 3.2 - 3.4` describes coverage. This distinction is intentional and should not be flagged as a docs/CI mismatch.

Learnt from: justin808
Repo: shakacode/react_on_rails PR: 2651
File: docs/oss/introduction.md:47-47
Timestamp: 2026-03-26T02:20:12.940Z
Learning: In `docs/oss/introduction.md` (and related docs in the `shakacode/react_on_rails` repo), the link to `docs/oss/getting-started/comparison-with-alternatives.md` described as "a side-by-side matrix with benchmarks" is intentionally and accurately worded. The page includes actual benchmark sections (e.g., Vite vs Rspack benchmark tables), so the phrase "with benchmarks" should NOT be flagged as misleading in future reviews.

Learnt from: justin808
Repo: shakacode/react_on_rails PR: 2857
File: README.md:0-0
Timestamp: 2026-03-26T08:32:31.881Z
Learning: In `README.md` (and related docs) for `shakacode/react_on_rails`, the Node.js minimum version (`>= 18`) deliberately reflects the actual package validator/system check floor, not the CI-tested range (`20-22`). The README explicitly distinguishes these two with parenthetical "(package minimum; CI tested: 20 - 22)". Do not flag this as a mismatch — it is intentional. Changing the documented minimum to match the CI floor would conflict with the runtime validators.

Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.

Learnt from: justin808
Repo: shakacode/react_on_rails PR: 2516
File: packages/react-on-rails/package.json:65-70
Timestamp: 2026-03-05T08:09:38.420Z
Learning: In packages/react-on-rails/package.json, the tanstack/react-router optional peerDependency is intentionally kept broad (">= 1.0.0") rather than constrained to a minor range. Compatibility with internal APIs (router.__store.setState, router.ssr, matchRoutes) is enforced at runtime via validateRouterInternals in packages/react-on-rails/src/tanstack-router/serverRender.ts, which throws clear errors if internals change.

Learnt from: justin808
Repo: shakacode/react_on_rails PR: 2610
File: docs/pro/react-server-components/create-without-ssr.md:13-22
Timestamp: 2026-03-24T21:38:26.825Z
Learning: In `docs/pro/react-server-components/create-without-ssr.md`, JS install instructions for React on Rails Pro should only install `react-on-rails-pro` (not `react-on-rails` separately), because the Pro package already includes the base package functionality. Use `--exact` (yarn/pnpm) or `--save-exact` (npm) flags to pin to an exact version for reproducibility.

Learnt from: justin808
Repo: shakacode/react_on_rails PR: 2608
File: CHANGELOG.md:28-28
Timestamp: 2026-03-15T10:30:44.740Z
Learning: In the shakacode/react_on_rails project, the date in a CHANGELOG.md version header (e.g., `### [16.4.0.rc.10] - 2026-03-14`) reflects when the changelog version stamp was created by the `/update-changelog` workflow, not necessarily the PR creation date. Do not flag a date mismatch between the changelog header and the PR creation date.

@justin808
Copy link
Copy Markdown
Member Author

Review checkpoint — review feedback addressed in 02b66cd

Addressed by I (Claude Code) on behalf of @justin808:

@chatgpt-codex-connector[bot] (P2):

  • Removed the claim that Webpacker-era apps "can work with React on Rails" — doctor.rb flags Webpacker as a removed breaking-change issue and the gemspec requires shakapacker >= 6.0. Removed the "intentionally stay on Webpacker / Webpack 4" subsection and the "Still on Webpacker is supportable" concluding paragraph.

@claude[bot] (inline + review summary):

  • Clarified Shakapacker version expectations on line 9: 7+ baseline with a note that server_bundle_output_path auto-detection requires 9.0+.
  • Added a link to the Shakapacker upgrade guide in step 1 of the Preferred path.
  • Replaced Preflight step 1 with a back-reference to the Preferred path section to avoid duplicating advice (from the review summary).
  • Added a note in the vite_rails doc that import.meta.glob has no direct Webpack equivalent and must be replaced with explicit require.context calls.

All four resolved threads: #discussion_r3104807938, #discussion_r3104808202, #discussion_r3104808407, #discussion_r3104808522.

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 18, 2026

Thanks for the update — good to know those were all addressed in 02b66cd. The docs changes are solid and the staged guidance (Webpacker → Shakapacker first, then React on Rails) is exactly the kind of upfront self-classification that saves teams from unnecessary debugging. LGTM.

Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
Comment thread docs/oss/migrating/migrating-from-vite-rails.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 18, 2026

Review: docs: legacy Webpacker and migration-fit guidance

Overall: Solid, targeted docs improvement. The additions directly address the issue — readers can now self-classify before starting a migration, which should cut down on "React on Rails is broken" confusion caused by Webpacker/Shakapacker mismatch or wrong-first-target choices. The prose is clear and the staging advice (separate PRs for bundler vs. RoR install) is practical.

What works well

  • The three-way classification in "Pick the right first target" is the right mental model for readers to encounter first.
  • Calling out that react_on_rails doctor explicitly flags Webpacker is a useful pointer — it tells readers the tooling will catch this rather than leaving them to debug silently.
  • The "wrong first target" paragraph at the end of the classification section effectively names both failure modes, which is exactly what issue Docs: add explicit legacy Webpacker and migration-fit guidance #3138 asked for.
  • The SPA-shell decision framework in the vite guide (move Rails back to view-owner vs. keep SPA shape and replace build integration) is a genuinely helpful distinction that most docs skip.

Minor issues

Two inline comments are posted:

  1. Missing version for the Webpacker pinning advice (migrating-from-react-rails.md line 22) — "a version that predates Webpacker removal" leaves the reader without a concrete version to pin to. Naming the actual cutoff version makes this immediately actionable.

  2. require.context needs more context (migrating-from-vite-rails.md line 25) — noting that import.meta.glob has no Webpack equivalent is correct, but require.context has a meaningfully different API (sync/async, eager/lazy, key extraction). A link to the webpack docs or a one-line example would save readers a detour.

Nit: Shakapacker upgrade link anchor

Line 19 of migrating-from-react-rails.md links to https://github.com/shakacode/shakapacker#upgrading-from-webpacker. Worth verifying that anchor exists in the current Shakapacker README — if the section was renamed or removed, readers will land at the top of the page without knowing why.

No concerns on

  • Security: docs-only, no code impact.
  • Formatting: Prettier passes per PR description.
  • Cross-references: the internal anchor links (#preferred-path-for-webpacker-era-apps) are consistent with the section headings as written.

- Specify `< 16.0` as the Webpacker-supporting pin in the Webpacker
  fallback guidance (v16 is the release that removed Webpacker support
  per CHANGELOG.md).
- Fix the broken Shakapacker upgrade anchor
  (`#upgrading-from-webpacker` does not exist); link to the
  Webpacker → Shakapacker v6 upgrade doc instead.
- Expand the `require.context` note in the vite_rails migration doc to
  call out the API differences (sync/async, eager/lazy, manual key
  extraction) and link to the webpack docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@justin808
Copy link
Copy Markdown
Member Author

Review checkpoint — follow-up feedback addressed in f4ed225

Addressed by I (Claude Code) on behalf of @justin808:

@claude[bot] (inline, migrating-from-react-rails.md):

  • discussion_r3104813255 — Specified the concrete pin for Webpacker-era apps: react_on_rails < 16.0 (v16 is the release that removed Webpacker support per CHANGELOG.md line 526). The reviewer's suggested < 13.0 was off — v13 still supported Webpacker.

@claude[bot] (inline, migrating-from-vite-rails.md):

@claude[bot] (review summary nit about the Shakapacker anchor link):

  • The #upgrading-from-webpacker anchor does not exist in the Shakapacker README. Replaced the link with Shakapacker's v6 upgrade guide, which is specifically about Webpacker → Shakapacker v6 migration. Verified offline and by lefthook's link check.

Rationale replies on already-addressed threads (resolved):

All six review threads on this PR are now resolved.

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/oss/migrating/migrating-from-react-rails.md (1)

102-105: ⚠️ Potential issue | 🟠 Major

Document both positional-call failure modes explicitly.

This section tells users to convert legacy calls, but it should explicitly warn that failure behavior differs by arity: 3+ args fail fast, while exactly 2 args can silently drop props. That silent path is easy to miss during migration.

✍️ Suggested doc patch
       These commands list candidates only. Inspect each match manually and convert any legacy positional calls
       (for example `react_component('Post', `@props`, prerender: true)`, `react_component 'Post', `@props``,
       `react_component :Post, `@props``, or `react_component component_name, `@props``) to options-style props
       before running tests.
+
+      Important: legacy positional calls fail in two different ways when `react_on_rails` wins helper resolution:
+      - Calls with 3+ positional args usually raise `ArgumentError` at render time (fast failure).
+      - Calls with exactly 2 positional args (`component_name`, props hash) may be accepted but drop props silently.
+      Treat both as required fixes before considering migration complete.

Based on learnings: In react_on_rails/lib/react_on_rails/helper.rb (line 84), react_component(component_name, options = {}) causes two distinct legacy positional-call failure modes (3+ args error vs 2 args silent props drop), and migration docs should distinguish both explicitly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/oss/migrating/migrating-from-react-rails.md` around lines 102 - 105, The
docs mention converting legacy positional calls but don't call out the two
distinct failure modes of react_component when called positionally; update the
paragraph to explicitly warn that react_component(component_name, options = {})
in react_on_rails/lib/react_on_rails/helper.rb produces two different behaviors:
calls with 3+ positional arguments raise an immediate error, whereas calls with
exactly 2 positional arguments silently drop the props, so instruct users to
search for positional usages like react_component('Post', `@props`, prerender:
true), react_component 'Post', `@props`, react_component :Post, `@props`, or
react_component component_name, `@props` and convert them to the options-style
form to avoid both hard failures and silent prop loss.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@docs/oss/migrating/migrating-from-react-rails.md`:
- Around line 102-105: The docs mention converting legacy positional calls but
don't call out the two distinct failure modes of react_component when called
positionally; update the paragraph to explicitly warn that
react_component(component_name, options = {}) in
react_on_rails/lib/react_on_rails/helper.rb produces two different behaviors:
calls with 3+ positional arguments raise an immediate error, whereas calls with
exactly 2 positional arguments silently drop the props, so instruct users to
search for positional usages like react_component('Post', `@props`, prerender:
true), react_component 'Post', `@props`, react_component :Post, `@props`, or
react_component component_name, `@props` and convert them to the options-style
form to avoid both hard failures and silent prop loss.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 956247c1-f4ef-4b9e-b967-59d2349825b3

📥 Commits

Reviewing files that changed from the base of the PR and between 02b66cd and a1a3eb0.

📒 Files selected for processing (2)
  • docs/oss/migrating/migrating-from-react-rails.md
  • docs/oss/migrating/migrating-from-vite-rails.md

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 18, 2026

Review: docs — legacy Webpacker and migration-fit guidance

Summary

Documentation-only PR that adds self-classification guidance to both migration guides so teams pick a realistic first migration target. Addresses a real gap: teams were hitting Webpacker incompatibility and concluding React on Rails was broken.

Strengths

  • Well-placed sections: new guidance appears before "Preflight" in both files — readers see it before they start, not after they're already stuck.
  • Technically accurate: Webpacker removal in v16, Shakapacker 9.0+ auto-detection, and the require.context migration details are all correct.
  • Good cross-referencing: the updated Preflight item 1 and the new intro sentence on the Webpacker checklist eliminate duplicated guidance without removing the checklist itself.
  • Concrete pinning advice: the < 16.0 recommendation is immediately actionable for teams that can't migrate off Webpacker yet.
  • Shakapacker v6 upgrade link points to the v6.6.0 tag — stable, won't drift.

Issues (flagged inline)

  1. Ambiguous "option 1" reference (migrating-from-vite-rails.md, line 25): "For most teams, option 1 is the fastest first step" refers to the Keep the SPA shape sub-item, not to Rails-owned island mounts (the first top-level bullet). Easy to misread when scanning. Suggest naming it explicitly.

  2. Dense import.meta.glob paragraph (migrating-from-vite-rails.md, line 25): The require.context mode-argument breakdown is accurate but is heavy technical detail for an orientation section whose job is self-classification. The existing step 5 ("Replace Vite-specific asset and env usage") is the natural home for Vite→Webpack API mapping.

  3. Long SPA-shells bullet (migrating-from-react-rails.md, line 11): 4+ sentences vs. one or two for the other two bullets. Trimming and moving the Popmenu reference to a prose sentence after the list would improve scannability without losing the signal.

Minor

  • No changelog entry needed — documentation fixes are explicitly excluded per the project guidelines.
  • The docs correctly distinguish react_component vs react_component_hash for multi-region SSR — that's accurate API usage.

Overall this is a clear improvement to the migration docs. The two inline suggestions are optional polish; the ambiguous "option 1" reference is the only one I'd call a real readability issue worth fixing before merge.

Addresses review feedback on the Vite migration guide:

- Name the "Keep the SPA shape" path explicitly in the follow-up
  paragraph so it does not read as ambiguous "option 1" (which could be
  misread as the first top-level bullet).
- Move the require.context mode-argument breakdown out of the orientation
  section and into step 5 "Replace Vite-specific asset and env usage",
  which is the natural home for Vite-to-Webpack API mapping.
- Add a concrete Popmenu example (110grill.com) in both migration guides
  so readers can see the single-top-level-component pattern in the wild.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 18, 2026

This is a solid docs-only improvement that directly addresses the confusion described in #3138. The staged migration guidance (Webpacker → Shakapacker as its own PR, then React on Rails) is exactly the right mental model, and the self-classification sections are practical and actionable.

Strengths

  • The "Pick the right first target" framing is excellent — naming the failure mode ("React on Rails is broken" when it is actually a bundler issue) is the most useful thing the docs can do.
  • Pinning to react_on_rails < 16.0 for teams stuck on Webpacker is concrete and unambiguous.
  • The cross-reference structure (preflight → preferred path → checklist) avoids duplicating guidance while making it discoverable from all three entry points.
  • The import.meta.globrequire.context section fills a real gap that was missing from the vite migration guide.

Issues

  1. require.context description undersells the API shape difference (inline comment below). The current text says "Webpack uses a regex argument, not a glob string", which is correct but implies the two APIs have a similar call structure. In reality require.context takes three separate arguments — (directory, useSubdirectories, regExp) — not a glob-style path. A one-line example would close this gap.

  2. The Shakapacker v6.6.0 link in the Webpacker-era section anchors teams on an older minor version. Since the classification section already mentions Shakapacker 9.0+ for auto-detection, consider linking to the latest Shakapacker upgrade docs or the main README so teams target the current stable release rather than 6.6.0.

  3. The Popmenu / 110grill.com real-world example appears in almost identical language in both files. Fine now, but consider keeping it in one place and cross-referencing in the other to avoid drift.

Minor: The SPA-shell bullet in migrating-from-react-rails.md is the longest single list item in either file and spans several distinct thoughts. Sub-bullets or a short code snippet would help skimmability (inline comment below).

Comment thread docs/oss/migrating/migrating-from-vite-rails.md
Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
Addresses PR #3157 review feedback from @claude[bot]:

- react-rails.md: split the long "Client-routed SPA shells" bullet into
  skimmable sub-bullets (mount strategy, Popmenu callout, separate-islands
  note).
- vite-rails.md: add a concrete before/after JS snippet showing
  import.meta.glob vs require.context so readers don't have to infer the
  API shape from prose.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@justin808
Copy link
Copy Markdown
Member Author

Review checkpoint — follow-up feedback addressed in 9f36b14

Addressed by I (Claude Code) on behalf of @justin808:

@claude[bot] (inline):

  • discussion_r3105745754 / discussion_r3105758038 (deduped) — split the long "Client-routed SPA shells" bullet in docs/oss/migrating/migrating-from-react-rails.md into sub-bullets (mount strategy → Popmenu production callout → "keep islands-split as a separate product decision" note) so each point is skimmable.
  • discussion_r3105757898 — added a concrete before/after JS snippet in docs/oss/migrating/migrating-from-vite-rails.md section 5 showing import.meta.glob('./dir/**/*.js') next to require.context('./dir', true, /\.js$/) plus the .keys() + key-lookup call shape, so the API difference is actionable instead of prose-only.

Already addressed on prior pass (baf4355):

  • discussion_r3105745671 — the "option 1" ambiguity was fixed (line 25 now names the "Keep the SPA shape" path explicitly) and the dense import.meta.glob detail had already been relocated from the orientation section to section 5. Replied + resolved the thread.

All four unresolved threads are now resolved.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 19, 2026

Review: docs: legacy Webpacker and migration-fit guidance

Overall this is a well-targeted, accurate documentation improvement. The classification sections ("Pick the right first target" / "Two different starting points") directly address the problem from issue #3138 and the writing is clear. A few technical notes below.

Verified accurate

  • react_on_rails doctor does check for config/webpacker.yml / bin/webpacker and emits "Webpacker support removed - migrate to Shakapacker >= 6.0" (confirmed in react_on_rails/lib/react_on_rails/doctor.rb:1372–1374).
  • The require.context(dir, deep, regex, mode) 4th-argument mode values listed are correct per Webpack 5 docs.

Issues worth addressing

import.meta.globrequire.context — semantic mismatch not surfaced

The before/after code block has two silent gotchas that are likely to trip up a reader doing a real migration:

  1. Key path format differs. Vite returns paths relative to the calling module (e.g. './dir/foo.js'). require.context('./dir', ...) returns paths relative to the context directory (e.g. './foo.js'). Any code that uses the key string (routing, component-name derivation, etc.) needs adjustment.

  2. Sync vs async semantics differ. import.meta.glob is lazy by default — the object values are () => import(...) (a function returning a Promise). The example correctly shows this. But the Webpack side shows ctx('./foo.js') → the module, which is synchronous. A reader who replaces await module() with ctx('./foo.js') will silently lose the async behaviour. The lazy equivalent in Webpack is import(/* webpackMode: "lazy" */ \./dir/${key}`), not a require.context` call.

These are worth calling out even briefly — see inline comment for a suggested diff.

Shakapacker v6 upgrade guide link pins to v6.6.0 tag

https://github.com/shakacode/shakapacker/blob/v6.6.0/docs/v6_upgrade.md is stable, but if that file ever moves or the canonical reference becomes the main-branch version, the link will silently go stale. Pointing at main or the latest release tag rather than a specific patch tag is slightly more resilient. Low priority.

Minor observations

  • The Popmenu / 110grill.com social-proof example appears verbatim in both files. Fine for now, but if the reference ever needs updating it will need touching in two places.
  • The SPA-shell bullet in migrating-from-react-rails.md gives a recommendation (react_component / react_component_hash) but no migration steps for that shape — readers are left to figure out the rest from the vite guide or Pro docs. That gap pre-dates this PR, so out of scope here, but worth a follow-up issue.

Comment thread docs/oss/migrating/migrating-from-vite-rails.md Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f36b14c66

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
Address PR #3157 review feedback:

- migrating-from-react-rails.md: rephrase "does not install alongside
  `gem \"webpacker\"`" — the install generator does not enforce a hard
  install-time block; the actual constraint is unsupported configuration
  surfaced via `react_on_rails doctor`.
- migrating-from-vite-rails.md: expand the import.meta.glob → require.context
  example with the key-path-format mismatch (relative to caller vs context
  dir) and the sync-vs-async distinction (lazy import.meta.glob vs
  synchronous ctx(key)). Adds an explicit lazy-equivalent recipe using
  dynamic import().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@justin808
Copy link
Copy Markdown
Member Author

Review checkpoint — follow-up feedback addressed in 6a86348

Addressed by I (Claude Code) on behalf of @justin808:

@chatgpt-codex-connector[bot] (P2, inline migrating-from-react-rails.md:172):

  • discussion_r3106597650 — Rephrased "does not install alongside gem \"webpacker\"" to "does not support gem \"webpacker\"" and added the explicit detail that the install generator does not enforce a hard install-time block; the actual mechanism is react_on_rails doctor flagging Webpacker when it detects config/webpacker.yml or bin/webpacker. Verified against react_on_rails/lib/react_on_rails/doctor.rb:1371-1373 and install_generator.rb (no Webpacker guard).

@claude[bot] (inline migrating-from-vite-rails.md:149-160, deduped with the same finding in PR review comment 4275625044):

  • discussion_r3106591422 — Expanded the import.meta.globrequire.context example to surface both semantic mismatches: (1) key paths differ (Vite returns './dir/foo.js' relative to caller; require.context returns './foo.js' relative to context dir), and (2) sync-vs-async (import.meta.glob is lazy by default; ctx(key) is synchronous). Split into an eager / synchronous before/after and a lazy recipe that builds a map of dynamic import() calls.

Rationale for the remaining items in PR review 4275625044 (not changed):

  • Shakapacker v6.6.0 link stability. Reviewer flagged this as "low priority" and "stable." Already revisited in fb6383e — pinning to a tag is intentional precisely so the link does not silently drift with main. Leaving as-is.
  • Popmenu / 110grill.com duplication across both files. Reviewer noted "fine for now." The cost of cross-referencing one file from the other (forcing the reader to context-switch between two migration guides) is higher than the cost of touching two lines if the reference ever needs updating. Leaving the verbatim mention in both files.
  • SPA-shell migration steps gap in migrating-from-react-rails.md. Reviewer explicitly flagged as "out of scope here, but worth a follow-up issue." Agreed — this is a real documentation gap but not what this PR is solving (#3138 is about up-front migration-target classification, not full SPA-shell migration steps for the react-rails guide). Will track separately.

Resolving the two inline threads.

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

Comment thread docs/oss/migrating/migrating-from-vite-rails.md
Comment thread docs/oss/migrating/migrating-from-vite-rails.md Outdated
Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 23, 2026

Code Review: docs: legacy Webpacker and migration-fit guidance

Overview

Documentation-only PR that adds self-classification guidance to both migration docs so teams can identify the correct first migration target before starting. The core content — Webpacker-era staged path, SPA vs. island distinction, import.meta.globrequire.context replacement — is solid and directly addresses the root problem from issue #3138.


Strengths

  • Clear app-shape taxonomy. The three-category classification (Shakapacker-baseline islands / Webpacker-era / SPA shells) is actionable and matches the actual friction patterns teams hit.
  • Staged Webpacker path is correct. Requiring webpacker → shakapacker as its own PR before adding react_on_rails is the right recommendation and the reasoning is clearly explained.
  • import.meta.glob section is the most technical addition and largely gets it right. The two semantic mismatches (key path relativity, sync vs. async) are the ones that actually bite during migration, and documenting them here is valuable.
  • Cross-references are consistent — the new sections and the existing Preflight / checklist sections point at each other correctly.

Issues Found

1. require.context mode vs. /* webpackMode */ conflation (migrating-from-vite-rails.md, line 146)

The bullet describing mode values ('sync', 'lazy', 'lazy-once', 'eager', 'weak') implies these are passed as a mode argument to require.context (which is technically valid — it accepts a 4th arg), but the lazy code example below uses /* webpackMode: "lazy" */ magic comments on the import() call instead. These are two separate mechanisms with different scopes, and mixing the description of one with the example of the other is confusing. Inline comment filed.

2. Lazy import.meta.glob replacement example has three issues (migrating-from-vite-rails.md, lines 175–178)

  • The resulting lazyModules keys are require.context-relative ('./foo.js'), not Vite-relative ('./dir/foo.js'). The text warns about key path differences but doesn't show how to produce keys in the same format as Vite — a reader building a drop-in replacement will silently get wrong lookups.
  • The dynamic template literal in import() causes Webpack to create a broad context module; adding /* webpackInclude: /\.js$/ */ alongside /* webpackMode: "lazy" */ scopes it correctly.
  • key.slice(2) is safe per the Webpack spec but a short comment would make the intent legible. Inline comment filed.

3. Duplicate Popmenu production reference (migrating-from-react-rails.md line 12, migrating-from-vite-rails.md line 22)

The exact same sentence about Popmenu appears in both files verbatim. If the deployment details change — URL, company name, example sites — there are two places to update. A shared callout or a single canonical paragraph with a cross-link from the other file would reduce maintenance risk. Inline comment filed.


Minor / Non-blocking

  • migrating-from-react-rails.md opens with ## (H2) while migrating-from-vite-rails.md opens with # (H1). Pre-existing inconsistency, not introduced here, but worth noting for a future cleanup pass.
  • The note about server_bundle_output_path requiring Shakapacker 9.0+ (line 9 of react-rails doc) is a useful precision. Consider whether it belongs in the installation/configuration docs as well rather than only in the migration guide.

Summary

The additions are well-motivated and the staged Webpacker path guidance is clearly correct. The three issues above are real — particularly the lazy module key-path mismatch, which will silently break code that copies the example verbatim — but they're all fixable with small targeted edits. The PR is close to merge-ready once those are addressed.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a863487d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/oss/migrating/migrating-from-vite-rails.md Outdated
Resolves merge conflicts in docs/oss/migrating/migrating-from-react-rails.md
by keeping both the app-shape classification ("Pick the right first target"
plus "Preferred path for Webpacker-era apps" from this branch) and the
"Choose a first slice" section and Example Migrations link from main.

Also drops the Popmenu / 110grill.com reference from the react-rails guide:
Popmenu does not migrate from react-rails, so the name-drop was off-topic
in that document.

Addresses unresolved review feedback on the lazy require.context example
in docs/oss/migrating/migrating-from-vite-rails.md:

- Rewrites the lazy example to use require.context with mode: 'lazy' so
  ctx(key) returns Promise<Module>, removing the conflation between the
  mode argument (discussed in text) and webpackMode magic comments (used
  in the prior example). Fixes the factually wrong claim that
  require.context is "not a direct replacement" for default-lazy Vite.
- Updates the "Sync vs async" bullet to explicitly point readers to the
  lazy example for async semantics via the 4th 'lazy' argument.

Closes review comments discussion_r3127921272, discussion_r3127921792,
and discussion_r3127929295. discussion_r3127921912 (Popmenu duplicate)
addressed by removing the reference from the react-rails guide entirely.
@justin808
Copy link
Copy Markdown
Member Author

Review checkpoint — follow-up feedback addressed in cd947b5

Addressed by I (Claude Code) on behalf of @justin808:

@claude[bot] (inline):

  • discussion_r3127921272 / discussion_r3127929295 (P2, @chatgpt-codex-connector[bot], deduped — same underlying fix) — Rewrote the lazy example in docs/oss/migrating/migrating-from-vite-rails.md to use require.context('./dir', true, /\.js$/, 'lazy'). ctx(key) then resolves to Promise<Module>, so require.context IS the direct lazy replacement for default-lazy import.meta.glob (verified against webpack's require.context docs). This single rewrite (a) removes the conflation between the 4th mode argument and /* webpackMode: "lazy" */ magic comments and (b) fixes the factually wrong "not a direct replacement" framing.
  • discussion_r3127921792 — The rewrite above makes sub-issues Make work with turbolinks and better helper #2 (missing webpackInclude on a dynamic import() template literal) and Add linting and CI scripts #3 (key.slice(2) legibility) moot, because the example no longer uses a dynamic import() template literal or a .slice call. Sub-issue TODO for first version #1 (key path mismatch) is still explicitly called out in the prose on line 161 ("Code that derives names from keys... needs to account for this"). Keeping the example keys context-relative mirrors require.context's natural API and matches that warning; silently normalizing them in the example would paper over the real API difference.
  • discussion_r3127921912 — Addressed differently from the suggestion. Rather than extract the Popmenu reference to a shared callout, removed it from migrating-from-react-rails.md entirely — Popmenu does not migrate from react-rails, so the name-drop was off-topic in that doc. The reference remains in migrating-from-vite-rails.md, where it is on-topic. Eliminates the duplication and drift risk at the source.

Merge conflicts resolved:

Merged latest origin/main into jg/3138-fix (proper merge commit with two parents). The conflict in migrating-from-react-rails.md was caused by main adding a new "Choose a first slice" section and a link to Example Migrations in the same region this PR had added "Pick the right first target" + "Preferred path for Webpacker-era apps". Kept all four: intro link to Example Migrations → app-shape classification → first-slice scoping → Webpacker-era preferred path. PR is now MERGEABLE.

All four previously-unresolved review threads are now resolved.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd947b5bf8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/oss/migrating/migrating-from-react-rails.md Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 23, 2026

Review: docs — legacy Webpacker and migration-fit guidance

Overall: Excellent addition. The "self-classify before you start" framing directly addresses the failure mode described in #3138, and the staged PR recommendation for Webpacker apps is exactly the kind of opinionated guidance this doc has been missing.

Technical accuracy ✅

The import.meta.globrequire.context migration guide is accurate:

  • Mode values ('sync', 'lazy', 'lazy-once', 'eager', 'weak') match Webpack's documented API.
  • The lazy () => ctx(key) wrapper correctly mirrors Vite's () => import(...) shape.
  • The server_bundle_output_path auto-detection caveat for Shakapacker 6–8 is a useful, precise call-out.
  • Pinning to < 16.0 for Webpacker-locked apps is the right escape hatch.

One substantive concern — key-path mismatch not shown in the lazy example

The eager example has an explicit code comment flagging the key format difference:

// ctx.keys() → ['./foo.js', ...]  ← keys relative to context dir, NOT './dir/foo.js'

But the lazy example omits a parallel comment. Readers who focus only on the lazy pattern (which is the default Vite shape and therefore the most common migration case) won't see the warning unless they also read the eager example and bullet point 1 above it. See the inline comment below for a suggested addition.

Minor nits

  • Popmenu / 110grill.com reference — a nice concrete anchor, but it's a live external URL. If Popmenu ever migrates away or the restaurant site goes offline, the link will break lychee checks. Consider whether a link to a more stable case study (e.g., a shakacode.com page or a GitHub repo) would be more durable.
  • 'sync' in the mode list — technically valid as an explicit 4th argument, but Webpack treats it identically to the 3-argument form. Worth noting "(the default)" next to it to avoid confusion.

Structure and cross-references ✅

All anchor links for the new sections (#preferred-path-for-webpacker-era-apps, #5-replace-vite-specific-asset-and-env-usage) resolve correctly in the current file. The cross-reference added to "Practical checklist for Webpacker-era apps" nicely ties the two sections together without redundancy.

Test / validation ✅

Prettier + lychee link checks passing per the PR description — no further CI concerns for a docs-only change.


Approachable fix for a real user pain point. The one inline suggestion is the only change I'd consider before merging.

Comment thread docs/oss/migrating/migrating-from-vite-rails.md
@justin808
Copy link
Copy Markdown
Member Author

Address-review checkpoint for PR #3157.

Scan window: selected follow-up from user triage after reply batch 6a863487d; no earlier <!-- address-review-summary --> checkpoint was present in this run.

Mattered

  • Addressed MUST-FIX: docs/oss/migrating/migrating-from-react-rails.md:36 now pins the Webpacker fallback to ~> 14.2 and notes that v15.0.0 is retracted. Commit: 2bf011b36. Replied to and resolved discussion_r3128017287.

Optional

  • None.

Skipped

  • None.

Validation

  • pnpm exec prettier --check docs/oss/migrating/migrating-from-react-rails.md passed.
  • git diff --check passed.
  • Pre-commit hooks passed: trailing-newlines, offline markdown-links, Prettier.
  • Pre-push hooks passed: branch-lint (no Ruby files) and online markdown-links.
  • bundle exec rubocop was run and failed on pre-existing unrelated Ruby offenses in Gemfile and react_on_rails_pro/spec/...; no Ruby files were changed.

Future full-PR scans should start after this comment unless check all reviews is requested.

@justin808
Copy link
Copy Markdown
Member Author

Address-review checkpoint for PR #3157.

Scan window: reran the full-PR scan after the prior checkpoint at 2026-04-23T05:03:41Z; no new review feedback was found after that cutoff. While re-checking PR state, I cleared one older unresolved Claude thread that was still keeping the review gate red.

Mattered

  • Addressed review-gate thread: docs/oss/migrating/migrating-from-vite-rails.md:187 now repeats the ctx.keys() key-path warning in the lazy require.context example. Commit: 7fde5c2f. Replied to and resolved discussion_r3128026529.

Optional

  • None remaining from the post-checkpoint scan.

Skipped

  • None.

Validation

  • pnpm exec prettier --check docs/oss/migrating/migrating-from-vite-rails.md passed.
  • git diff --check passed.
  • Pre-commit hooks passed: trailing-newlines, offline markdown-links, Prettier.
  • Pre-push hooks passed: branch-lint (no Ruby files) and online markdown-links.
  • bundle exec rubocop was rerun and still fails on pre-existing unrelated Ruby offenses in Gemfile and react_on_rails_pro/spec/...; no Ruby files were changed.

Future full-PR scans should start after this comment unless check all reviews is requested.

@justin808 justin808 merged commit e507afb into main Apr 23, 2026
11 of 12 checks passed
@justin808 justin808 deleted the jg/3138-fix branch April 23, 2026 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: add explicit legacy Webpacker and migration-fit guidance

1 participant