LeadershipNot yet confirmed elsewhere1 publisher3 min readPublished
Lexical 0.51 drops CommonJS from npm at the start of its clean-up before 1.0
Lexical 0.51 ships its npm packages as ESM-only and warns that anything deprecated will be removed soon. The module change mostly hits CommonJS code that loads Lexical without a bundler, while the removal warning gives the remaining migrations a window of a few monthly releases.
The Board Room · Leadership desk
What happened
- LexicalComposer cannot accept extensions, and the project says moving to its replacement, LexicalExtensionComposer, is usually a two-line change.
- If an app also loads yjs or @preact/signals-core through require(), a second copy can appear and handing its objects to Lexical breaks.
- exportJSON now reads withField properties straight off the node, so code holding a stale node reference can write stale values.
- The release adds an opt-in compact JSON export that only a Lexical version new enough to know the new schemas can read.
Compiled by The Board RoomSomething wrong?How this is made
Why it matters
- constraint Services that load Lexical through CommonJS on Node below 20.19 have to upgrade Node or rewrite those loads as dynamic imports before they can take 0.51.
- cost Holding back on an older release saves the module work this month, but it trades that saving for one larger upgrade once deprecated APIs start disappearing.
- decision Teams that store editor state and read it in several places have to finish upgrading every reader before any writer turns on compact export.
Every package in the release now declares "type": "module", and its exports map has no require branch [5]. The release notes are direct about who escapes: "Bundlers are unaffected." [6] CommonJS code on Node.js 20.19 or later can still require() the packages. Anything older has to use await import(...) [7]. Metro bundles both builds unless the team adds the condition for Lexical's packages [9]. The CommonJS build still exists, but only in the source tree, kept for Meta's www [2].
A dependency loaded two ways is the harder case. The duplicate-copy failure applies to any app that loads yjs or @preact/signals-core through require() while Lexical loads them as ESM [8]. The project's advice is to load those as ESM too [8]. For a collaborative editor built on Yjs, that means checking how each shared dependency is loaded before taking the upgrade.
Serialization is where a build can pass and the output can still be wrong. Lexical's own export paths, including editorState.toJSON() and the clipboard export, start from the node map and are unaffected [11]. The risk is in custom code that keeps a node reference across a mutation, and the notes' fix is to call getLatest() on that reference first [11]. A third breaking change moves the Prism helpers out of @lexical/code into @lexical/code-prism [12].
Timing comes from the deprecation warning. This is a monthly release, and the next few are expected to focus on moving everything to the Extension and $config APIs and removing deprecated functionality [1][4]. "Expect anything @deprecated to be removed soon," the notes say [3]. At one release a month, that is a window of a few months [18]. The notes do not give a date for 1.0 or say which release removes which API.
LexicalComposer's entry is softer than that general warning. It is deprecated in favour of LexicalExtensionComposer and "expected to be removed in a future major" [13]. On a 0.x version line, the notes leave open whether that means 1.0 itself or something later. The project's case for moving anyway is functional: an editor built by LexicalComposer cannot reach any feature shipped as an extension [14].
For a team deciding this quarter, the trade-off is between a module change now and a bigger combined job later. A team that pins below 0.51 avoids the ESM work today. If the forecast removals land, it would then take the ESM switch and the deleted APIs in a single upgrade [19]. A team that moves now takes the module change while the deprecated APIs still exist, and can replace them one at a time before they go [13].
Compact JSON export is the one place where moving early is the wrong order. It is opt-in, and its raw objects are well under half the legacy size, though after gzip the two are a wash [15]. The smaller raw size matters for structured clones and worker messages, according to the notes [15]. The schemas behind it are still marked experimental, and default output is unchanged [17].
What to watch
- The first release that actually deletes @deprecated APIs, and whether LexicalComposer goes with them or waits for a major version.
- Whether the declarative serialization schemas, experimental in 0.51, lose that label before 1.0.
- A published 1.0 date or a per-release removal list, either of which would turn the 'soon' warning into a fixed migration deadline.
Clarity's read
What the record supports and how the coverage leans. The claims behind it follow.
Reality
- Evidence72
- Adoption
- Insufficient
- Hype gap+5
- Incentives30
- Confidence68
Claim ledger
Ranked by verification strength, evidence, and original report placement.
- [1]
Lexical v0.51.0 is a monthly release whose main new feature lets nodes declare their JSON serialization as a schema on $config.
- [2]
Lexical is now publishing ESM-only to npm; CJS builds are still supported in the source tree, and the CommonJS build remains in-tree only for Meta's www.
- [3]
"Expect anything @deprecated to be removed soon."
- [4]
The release is described as a big step towards Lexical 1.0; the next few releases are expected to focus on moving everything, including docs and examples, to the latest Extension and $config APIs and removing deprecated functionality.
- [5]
Every Lexical npm package declares "type": "module" and its exports map offers development/production/default conditions with no require branch.
- [6]
"Bundlers are unaffected."
- [7]
CommonJS code can require() the packages on Node.js 20.19+ (the builds have no top-level await); older Node.js must use await import(...).
- [8]
A dependency the app also loads through require() can then exist twice, which breaks handing its objects to Lexical (yjs docs to @lexical/yjs, @preact/signals-core signals from @lexical/extension); the notes advise loading those as ESM too.
- [9]
Metro bundles both builds unless the condition for Lexical's packages is added.
- [10]
In lexical, exportJSON may serialize the instance as-is: a property declared with withField is read straight off the node instead of through its accessor, so exportJSON no longer resolves getLatest() and a stale reference can write stale values.
- [11]
Nothing inside Lexical is affected by the exportJSON change, since the walk, the clipboard selection export and editorState.toJSON() all start from the node map; users should call getLatest() themselves on a reference kept across a mutation.
- [12]
In @lexical/code, the deprecated Prism re-exports are gone along with the @lexical/code-prism dependency; those helpers must be imported from @lexical/code-prism.
- [13]
In @lexical/react, LexicalComposer is deprecated in favor of LexicalExtensionComposer and is "expected to be removed in a future major".
- [14]
LexicalComposer cannot accept extensions, so any feature shipped as one is unreachable from an editor it builds; the migration to LexicalExtensionComposer is usually a two-line change.
- [15]
Compact JSON export is opt-in; its raw objects are well under half the legacy size, which matters for structured clones and worker messages, but after gzip the two are a wash.
- [16]
Only a Lexical new enough to know the schemas can read the compact JSON form, so the notes advise writing the legacy form until every reader is upgraded.
- [17]
The declarative serialization schemas are experimental, and output is unchanged by default.
- [18]
At one release a month, the 'next few releases' in which deprecated functionality is expected to be removed span roughly a few months.
- [19]
A team that pins below 0.51 would take the ESM-only change and the removal of deprecated APIs together in one later upgrade, if the forecast removals happen.
Sources
1 independent publisher whose own reporting we read for this story.
- github.comLexical 0.51
1 article · October 9, 2026
Topics and entities
Follow any of these and your For You feed starts watching them — no settings page required.