Commit 34b7a1f
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
2 files changed
+12
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
102 | 105 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6839 | 6839 | | |
6840 | 6840 | | |
6841 | 6841 | | |
| 6842 | + | |
| 6843 | + | |
| 6844 | + | |
| 6845 | + | |
| 6846 | + | |
| 6847 | + | |
| 6848 | + | |
| 6849 | + | |
6842 | 6850 | | |
6843 | 6851 | | |
6844 | 6852 | | |
| |||
0 commit comments