Skip to content

EditorInput imports getDOMSelectionForEditor from lexical, which lexical does not export, so consumer webpack builds fail (1.7.12 to 1.8.1) #506

Open

Description

@OjasAT2105

Summary

src/components/editor-input/mention-plugin/lexical-typeahead-menu.tsx imports getDOMSelectionForEditor from lexical. That symbol is not part of lexical's public API and never has been, so any consumer bundling force-ui with webpack fails to build.

ERROR in ./node_modules/@bsf/force-ui/dist/components/editor-input/mention-plugin/lexical-typeahead-menu.es.js 55:12-13
export 'getDOMSelectionForEditor' (imported as 'Q') was not found in 'lexical'

The build exits 1, so it is not a warning a consumer can ship past.

Verified

Checked every published lexical release around the pinned one. None export it:

lexical exports getDOMSelectionForEditor
0.36.0 no
0.37.0 no
0.38.2 (the pinned version) no
0.39.0 no
0.40.0 no

What 0.38.2 does export, from LexicalUtils.d.ts:

export declare function getDOMSelection( targetWindow: null | Window ): null | Selection;
export declare function getDOMSelectionFromTarget( eventTarget: null | EventTarget ): null | Selection;

The file's own docblock explains how this happened: it ports lexical 0.38's LexicalTypeaheadMenuPlugin to restore the menuRenderFn contract, and an internal helper was carried across with the public ones.

Affected tags

Present in dist/ from 1.7.12 through 1.8.1, so no upgrade or downgrade avoids it. 1.7.11 and earlier are clean.

It became visible to consumers when they install from a release tarball rather than a git ref, because the tarball ships the committed dist/ rather than rebuilding it. Rollup treats lexical as external, so force-ui's own build never resolves the import and never fails.

Suggested fix

Use the exported function. lexical's internal helper is just the editor's window:

-import { getDOMSelectionForEditor } from 'lexical';
+import { getDOMSelection } from 'lexical';

-const selection = getDOMSelectionForEditor( editor );
+const selection = getDOMSelection( editor._window );

Impact

SureCookie and SureCookie Pro both fail npm run build on a clean install, which also breaks their release and Playwright workflows. Neither renders EditorInput; the module is pulled in only through the package barrel, so every consumer of force-ui is exposed regardless of whether they use the editor.

They are unblocked by a local webpack alias that re-exports lexical with the missing function added, which will be removed once a fixed tag ships.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions