I'm working on updating my plugins to V3 but keep running into this error when using the useConfig()
@967091941873426493/ui hook.
The issue can be recreated in this repo if you build the root then run the demo directory:
https://github.com/innovixx/payload-field-boilerplate( As you can see I'm just copying the Payload UI text field as I will use this as a boilerplate for custom fields e.g. colour pickers etc)
This happens if you have multiple versions of
@967091941873426493/ui installed. They need to match
I see in your demo folder you target ^3.2.2 and in your root package.json you target ^3.2.1
also worth testing out pnpm, I have had better luck with pnpm deduplicating dependencies compared to yarn, when I worked on a similar plugin setup
Cheers
@360823574644129795, Giving that a go now.
Just updated the dependencies and got rid of yarn. Still getting the same error. I'm only using the dependencies in the root to reference types. after that when the dist folder gets imported into the payload project it should just be using the demo dependencies
Not sure if this is useful to you but I actually got rid of the error after downgrading to react 18
Let me try changing my react version to see if it works. However, does Payload and Next 15 not rely on React 19?
I think nextjs runs react 19 in app router anyway.
I know it's weird but it did for me. Maybe it was something unrelated but it won't hurt to try
Cheers for the suggestion but this doesn't appear to work in this regard
Had the same issue and it was in fact caused by multiple versions of payloadcms/ui, as Alessio suggested. Running
pnpm why @payloadcms/uihelped identify where the multiple versions were coming from, it was not obvious at first glance. This was the output:
@payloadcms/next 3.3.0
└── @payloadcms/ui 3.3.0
@payloadcms/plugin-seo 3.2.2
└── @payloadcms/ui 3.2.2
@payloadcms/richtext-lexical 3.3.0
├─┬ @payloadcms/next 3.3.0 peer
│ └── @payloadcms/ui 3.3.0
└── @payloadcms/ui 3.3.0
@payloadcms/ui 3.2.2Getting everything to 3.3.0 fixed it for me. Might be worth double checking the versions 🤷
Didn't think about trying 'pnpm why' will give this a go this afternoon and see what it comes back with
I am running into the same issue.The exception is thrown as soon as I enter a document in my plugin dev project which contains a custom component from my plugin:
TypeError: Cannot destructure property 'config' of '(0 , _chunk_CKHKQPOO_js__WEBPACK_IMPORTED_MODULE_10__.b)(...)' as it is undefined.pnpm why @payloadcms/uioutputs
@payloadcms/ui 3.4.0in both the plugin root folder and the dev folder.
This could also be caused by duplicative react versions. So check out
pnpm why reactand
pnpm why react-domAnd if that does not work, I would experiment with different pnpm settings (those related to how packages are hoisted) and make sure symlinking is enabled
Also, I would manually check the pnpm-lock.json for duplicative package versions.
pnpm whysometimes does not display all of them
This could also be caused by duplicative react versions
Maybe that's why the react downgrade worked for me but not for you.
pnpm why @payloadcms/ui@payloadcms/next 3.2.2
└── @payloadcms/ui 3.2.2
@payloadcms/richtext-lexical 3.2.2
├─┬ @payloadcms/next 3.2.2 peer
│ └── @payloadcms/ui 3.2.2
└── @payloadcms/ui 3.2.2pnpm why react@payloadcms/db-mongodb 3.2.2
└─┬ payload 3.2.2 peer
└─┬ @monaco-editor/react 4.6.0
├── react 19.0.0-rc-65a56d0e-20241020 peer
└─┬ react-dom 19.0.0-rc-65a56d0e-20241020 peer
└── react 19.0.0-rc-65a56d0e-20241020 peer
@payloadcms/next 3.2.2
├─┬ @dnd-kit/core 6.0.8
│ ├─┬ @dnd-kit/accessibility 3.1.1
│ │ └── react 19.0.0-rc-65a56d0e-20241020 peer
│ ├─┬ @dnd-kit/utilities 3.2.2
│ │ └── react 19.0.0-rc-65a56d0e-20241020 peer
│ ├── react 19.0.0-rc-65a56d0e-20241020 peer
│ └─┬ react-dom 19.0.0-rc-65a56d0e-20241020 peer
│ └── react 19.0.0-rc-65a56d0e-20241020 peer
├─┬ @payloadcms/graphql 3.2.2
│ └─┬ payload 3.2.2 peer
│ └─┬ @monaco-editor/react 4.6.0
│ ├── react 19.0.0-rc-65a56d0e-20241020 peer
│ └─┬ react-dom 19.0.0-rc-65a56d0e-20241020 peer
│ └── react 19.0.0-rc-65a56d0e-20241020 peer
└─┬ @payloadcms/ui 3.2.2
└─┬ @dnd-kit/core 6.0.8
├─┬ @dnd-kit/accessibility 3.1.1
│ └── react 19.0.0-rc-65a56d0e-20241020 peer
└─┬ @dnd-kit/utilities 3.2.2
└── react 19.0.0-rc-65a56d0e-20241020 peerEverything looks as if it matches and I've even attempted '--shamefully-hoist' the packages and the error persists
Hi
@360823574644129795I'm out of ideas on this one, do you still suspect it is on my side or should I try producing a minimal recreation and opening an issue on GH?
I wouldn't open an issue, I'm pretty sure this is an issue with the specific set-up and not with Payload. Looking at your repo, the demo folder is basically its own project, independent of the parent project. While the
@967091941873426493/ui version may be the same, it's likely using its own copy, without deduplicating it. / It has its own independent node_modules
I think you should try to move this to a pnpm monorepo
I had a pretty similar setup like yours with my old lexical plugin, and had to alias react to use the react from the parent node_modules:
https://github.com/AlessioGr/payload-plugin-lexical/blob/develop/demo/src/payload.config.ts#L27I though the same so set up a clean project using npx create-payload-app and installed this as a module so no devDependancies would have been used and the issue persisted
Did you pack it as .tar.gz and installed that in a fresh payload app?
I would try moving
@967091941873426493/ui to
peerDependenciesinstead of
devDependenciesRight, you must be right that its a mismatch because deleting the root node_modules then starting demo works
Got it working, just had to comb through and lock the packages to specific versions. Shame pnpm why didn't help resolve this,
Thanks for the help all
Adding
{
"dependencies": ["@payloadcms/*", "payload"],
"packages": ["**"],
"pinVersion": "^3.15.1"
},to a
.syncpackrc.jsonwas super helpful for this
Hi how did you go about locking the packages to specific versions. I am having the exact same issue but cant find a solution.
I have tried all the steps above
What package manager are you using?
pnpm
I created a 'pnpm-workspace.yaml' with the contents of
packages:
- '.'
- 'demo'
I then went through both package.json and removed the '^' so "
@967091941873426493/eslint-config": "^3.0.0", is now ""
@967091941873426493/eslint-config": "3.0.0".
Removed the package-lock.yaml and the node_modules from both and then installed at root first then demo second and this seemed to fix it
Star
Discord
online
Get dedicated engineering support directly from the Payload team.