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]: TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher') #7672

Closed
MarcoLeko opened this issue Aug 23, 2024 · 1 comment · Fixed by #7675
Closed
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.

Comments

@MarcoLeko
Copy link

System Info

System:
OS: macOS 14.6
CPU: (10) arm64 Apple M1 Pro
Memory: 111.52 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
pnpm: 9.7.0 - ~/.nvm/versions/node/v18.18.2/bin/pnpm
bun: 1.1.12 - /opt/homebrew/bin/bun
Browsers:
Chrome: 128.0.6613.84
Safari: 17.6
npmPackages:
@rspack/cli: ^0.7.5 => 0.7.5
@rspack/core: ^0.7.5 => 0.7.5

Details

I was finally able to create a reproducible env for the bug that we experience during the migration of our webpack to rspack setup. The error that is thrown when SSR-ing the react content from the server with:

TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher')

We have a reproducible env where we bundle the application in 3 different flavours and our setup works on 2 of the 3 modes:

  • webpack + babel ✅
  • webpack + swc-loader ✅
  • rspack + buildin swc-loader 🔴

Reproduce link

https://github.com/MarcoLeko/rspack-can-not-read-property-of-undefined

Reproduce Steps

Steps to reproduce

I've provided a minimal reproducible env, to test it out:

Clone: Reproducible error project

Execute npm ci

Run: npm run webpack:swc:dev:server

Hit route: http://localhost:3001/ => works ✅

Run: npm run webpack:babel:dev:server

Hit route: http://localhost:3001/ => works ✅

*Run: npm run rspack:dev:server

Hit route: http://localhost:3001/ => will fail with TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher')🔴

@MarcoLeko MarcoLeko added bug Something isn't working pending triage The issue/PR is currently untouched. labels Aug 23, 2024
@MarcoLeko
Copy link
Author

You guys are freaking fast! Thank you ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@MarcoLeko and others