Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: monorepo root dependency react version not right #6224

Closed
tky753 opened this issue Sep 18, 2024 · 2 comments
Closed

[Bug]: monorepo root dependency react version not right #6224

tky753 opened this issue Sep 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@tky753
Copy link

tky753 commented Sep 18, 2024

Version

System:
    OS: Windows 11 10.0.22631
    CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
    Memory: 14.52 GB / 31.95 GB
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @modern-js/app-tools: 2.59.0 => 2.59.0
    @modern-js/tsconfig: 2.59.0 => 2.59.0

Details

my monorepo structure looks like:

- apps
   - app1
       - modern.config.ts
       - package.json
   - app2
       - modern.config.ts
       - package.json
- package.json

root package.json has dependencies like:

"dependencies": {
    "@modern-js/runtime": "2.59.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
},
"devDependencies": {
    "@modern-js/app-tools": "2.59.0",
    "@modern-js/tsconfig": "2.59.0",
    "typescript": "~5.0.4"
}

apps/app1 and app2 inherits dependencies from root

when I run modern dev in foder /apps/app1,
the browser shows warning:
Warning: ReactDOM.render is no longer supported in React 18.
image

it's because react is an inherited dependency, so the runtimePlugin can't get its version correctly.

Reproduce link

https://github.com/tky753/modern-js-monorepo-bug-report

Reproduce Steps

pnpm i
cd apps/app1
pnpm dev
@tky753 tky753 added the bug Something isn't working label Sep 18, 2024
@zllkjc
Copy link
Member

zllkjc commented Sep 19, 2024

Thanks for the feedback~. Currently, Modern.js requires defining React versions, and we recommend managing versions in sub-projects.

@zllkjc
Copy link
Member

zllkjc commented Sep 19, 2024

We do not plan to support this behavior for now

@zllkjc zllkjc closed this as completed Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants