Next 15 Support - React Library - Cannot read properties of undefined: (reading 'ReactCurrentOwner')
Unanswered
Florida White posted this in #help-forum
Florida WhiteOP
Hi there!
First off, I'm new to NextJS! I'm looking into what it will take for my React library to support Next15, but am running into issues. My library is on
Running
I must be doing something wrong, but am I right in my understanding that the Pages Router should work with React 18 libraries still? If not, what's the recommendation from Next for 3rd libraries who want to support Next 15 with both App and Pages router, without needing to upgrade to React 19 RC?
Thanks so much!!
First off, I'm new to NextJS! I'm looking into what it will take for my React library to support Next15, but am running into issues. My library is on
react
and react-dom
v^18.3.0
, I have these in the library's peerDependencies
, and have my viteconfig
set up to exclude them from the build. I created a new NextJS app using Pages Router to test with, which has the following verssons: next v15.0.1
, react v19.0.0-rc-69d4b800-20241021
, react-dom v19.0.0-rc-69d4b800-20241021
. Running
npm ls react && npm ls react-dom
in my Next app shows me the same versions of react/react-dom
as in package.json
, which tells me I don't have >1 versions of react/react-dom
running. However, when trying to build the Next app via npm run build
, I get the following error which (I think?) is also indicative of mismatched react
and react-dom
versions: Collecting page data .TypeError: Cannot read properties of undefined (reading 'ReactCurrentOwner')
.I must be doing something wrong, but am I right in my understanding that the Pages Router should work with React 18 libraries still? If not, what's the recommendation from Next for 3rd libraries who want to support Next 15 with both App and Pages router, without needing to upgrade to React 19 RC?
Thanks so much!!