Skip to content

Commit 34b7a1f

Browse files
justin808claude
andcommitted
Fix workspace dependency resolution for react-on-rails
Problem: When workspace packages (react-on-rails-pro and react-on-rails-pro-node-renderer) declared `"react-on-rails": "*"` as a dependency, Yarn Classic was incorrectly resolving this to [email protected] from the npm registry instead of using the local workspace package. This caused: 1. node_modules/react-on-rails folders to appear in Pro package directories 2. The installed version (16.1.2) lacked the new exports field entries 3. Webpack builds in generated examples failed with "Module not found" errors when importing from react-on-rails/pageLifecycle, etc. Root Cause: The yarn.lock file had cached a resolution to [email protected] from a previous state when the dependency was `"^16.2.0-beta.12"`. Even after changing back to `"*"`, Yarn kept the old npm registry resolution because 16.1.2 technically matches the `"*"` range. Solution: Added explicit `resolutions` field in root package.json to force Yarn to always use the workspace package via symlink: ```json "resolutions": { "react-on-rails": "link:./packages/react-on-rails" } ``` This ensures that any package in the workspace requesting `react-on-rails` will get a symlink to the local package instead of installing from npm. Verification: - Removed all node_modules and ran `yarn install` - Confirmed packages/react-on-rails-pro/ no longer has node_modules subdirectory - Confirmed yarn.lock now shows `react-on-rails@link:./packages/react-on-rails` - This will fix webpack module resolution in CI example builds 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent eed0dfa commit 34b7a1f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,8 @@
9898
"url": "https://github.com/shakacode/react_on_rails/issues"
9999
},
100100
"homepage": "https://github.com/shakacode/react_on_rails#readme",
101-
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
101+
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
102+
"resolutions": {
103+
"react-on-rails": "link:./packages/react-on-rails"
104+
}
102105
}

yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6839,6 +6839,14 @@ [email protected]:
68396839
neo-async "^2.6.1"
68406840
webpack-sources "^3.2.0"
68416841

6842+
react-on-rails@*:
6843+
version "0.0.0"
6844+
uid ""
6845+
6846+
"react-on-rails@link:./packages/react-on-rails":
6847+
version "0.0.0"
6848+
uid ""
6849+
68426850
react@^19.0.0:
68436851
version "19.2.0"
68446852
resolved "https://registry.npmjs.org/react/-/react-19.2.0.tgz#d33dd1721698f4376ae57a54098cb47fc75d93a5"

0 commit comments

Comments
 (0)