plate icon indicating copy to clipboard operation
plate copied to clipboard

Static Rendering issue on NextJS 16 with plate 52.0.8

Open 7H3XXX opened this issue 2 weeks ago • 5 comments

Description

Following the guide on Static rendering for statically rendered content with RSC (NextJS App router) gives this error :

Invalid source map. Only conformant source maps can be used to find the original code.
Cause: Error: sourceMapURL could not be parsed
... TypeError: Cannot read properties of undefined (reading 'H')

I tried downgrading to plate 51.1.3 and the issue doesn't appear there.

Reproduction URL

No response

Reproduction steps

1. Next 16.0.x AppRouter
2. Follow the instruction to install platejs
3. Try to render plate value/content statically -> [Static rendering](https://platejs.org/docs/static)
4. next dev
5. See error upon loading page

Plate version

52.0.8

Slate React version

0.118.1

Screenshots


Logs


Browsers

No response

7H3XXX avatar Dec 05 '25 12:12 7H3XXX

Hi @7H3XXX! I'm Dosu and I’m helping the plate team.

This is likely caused by a breaking change in Plate 51.x+: all static rendering features (like PlateStatic, serializeHtml, etc.) must be imported from platejs/static, not platejs docs, changelog. Double-check all your imports and update them if needed.

Also, make sure you pass your static components to createSlateEditor({ components }), not to PlateStatic or serializeHtml docs.

All Plate and @platejs/* packages must be on the exact same version (use the depset tool to align them), and deduplicate any Slate dependencies in your tree troubleshooting.

Plate 52.x is ESM-only and adds React Compiler support, which means you may need to update your Next.js config to transpile all platejs packages for source maps to work correctly PR.

If you still see errors after these steps, check for any interactive hooks or context-dependent components in your static rendering path—they must be replaced with pure static components discussion.

If you want to share a code snippet or more details about your setup, I can help debug further.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

dosubot[bot] avatar Dec 05 '25 12:12 dosubot[bot]

@dosu I tried all these steps, I can confirm there's an issue because I tried to replicate the static rendering example only relying on CLI commands provided in the docs (with Nextjs 16.0.7 and React 19.2.1) and the results was still the same but if i downgrade to platejs 51.1.3 there's no more issue.

7H3XXX avatar Dec 05 '25 14:12 7H3XXX

Thanks for confirming the repro. Plate 52.x is ESM-only and adds React Compiler support, so Next.js 16 projects must update their next.config.js to transpile all platejs packages for source maps and static rendering to work right. This is a new requirement—51.1.3 didn’t need it, which is why downgrading works.

Make sure your next.config.js includes:

// next.config.js or next.config.ts
const nextConfig = {
  // ...
  transpilePackages: [
    // ...any existing packages,
    ...require('fs')
      .readdirSync('node_modules')
      .filter(pkg => pkg.startsWith('@udecode') || pkg.includes('platejs')),
  ],
};
module.exports = nextConfig;

Or, if you’re using the latest Plate docs, just ensure all @platejs/* and platejs packages are listed in transpilePackages (see PR).

Also, double-check:

  • All static rendering imports are from platejs/static (not platejs).
  • All @platejs/* packages are on the exact same version (use the depset tool).
  • No duplicate Slate dependencies in your lockfile.

If you’re still seeing the error after this, please share your next.config.js and package.json and I’ll help debug further.

For hydration/context issues, use only static-safe components and, if you use the node-id plugin, pre-normalize your value with a deterministic idCreator and set normalizeInitialValue: null (see workaround).

Let me know if this helps or if you hit the error again after these changes.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

dosubot[bot] avatar Dec 05 '25 14:12 dosubot[bot]

@dosu I tried the fix in next.config.js and the error is the same so I guess it's a real issue. Downgrading to plate 51.1.3 even or newer version of NextJS had the issue gone. But on recent versions of plate the error is present.

7H3XXX avatar Dec 08 '25 15:12 7H3XXX

This is a known regression in Plate 52.x with Next.js 16—static rendering and source map errors like what you’re seeing are tracked in several issues and discussions. All the documented workarounds (transpilePackages, depset, static-safe components, deterministic IDs) don’t resolve the source map crash in 52.x. Downgrading to Plate 51.1.3 is currently the only reliable fix. The maintainers are aware and investigating; you can follow issue #4772, discussion #4773, and PR #4750 for updates.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

dosubot[bot] avatar Dec 08 '25 15:12 dosubot[bot]

It's fixed in latest version of platejs for me

felixfeng33 avatar Dec 13 '25 12:12 felixfeng33