You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case it helps anyone else, I have one more thing to check when you encounter hydration errors showing up as Next.js import-map / lexical errors in dev mode when using Payload 3.x on Next.js 15+.
I went through all github issues, followed accepted fixes, including the barrel file issue. I changed types and import map load order in my startup script per Mikrut's advice. Reverted node.js to 20.x. Nothing worked. I tried to find a relevant open issue to attach this fix to, but didn't see one, but since I wasted so much time on it I thought I'd post in case it's of any use.
In my case, the issue was a mismatch between importMap.js and importMap.ts. Since my dev startup script rebuilds types and import map each time (and bc I'm a bit of a numpty) I'd not gone in to eyeball the files directly. Somehow, my importMap.ts contained "export const importMap = {}" which Payload startup didn't clock as empty contents and read as good to go . Repopulating the file manually (or i suppose zeroing or removing it) meant the back end and front end were working from the same recipe again and my hydration errors disappeared.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
In case it helps anyone else, I have one more thing to check when you encounter hydration errors showing up as Next.js import-map / lexical errors in dev mode when using Payload 3.x on Next.js 15+.
I went through all github issues, followed accepted fixes, including the barrel file issue. I changed types and import map load order in my startup script per Mikrut's advice. Reverted node.js to 20.x. Nothing worked. I tried to find a relevant open issue to attach this fix to, but didn't see one, but since I wasted so much time on it I thought I'd post in case it's of any use.
In my case, the issue was a mismatch between importMap.js and importMap.ts. Since my dev startup script rebuilds types and import map each time (and bc I'm a bit of a numpty) I'd not gone in to eyeball the files directly. Somehow, my importMap.ts contained "export const importMap = {}" which Payload startup didn't clock as empty contents and read as good to go . Repopulating the file manually (or i suppose zeroing or removing it) meant the back end and front end were working from the same recipe again and my hydration errors disappeared.
Beta Was this translation helpful? Give feedback.
All reactions