Skip to content

Lexical code highlighting takes half of the main bundle size #2976

@Soxasora

Description

@Soxasora

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

@lexical/code-shiki takes almost half of the main _app bundle due to how code-shiki is built and published. Single-file output takes all the imports and bundles them in the output, thus all of the Shiki internal imports are included, causing an output of ~9MB.

Screenshots

_app bundle containing code-shiki

image

Steps To Reproduce

  1. Load SN
  2. Shiki is fully loaded

Expected behavior

Every code block (CodeNode) should fetch the code language and theme on-demand, just like Shiki behaves by default.

Logs

No response

Device information

No response

Additional context

This is a bug in Lexical's build configuration, we either need to wait for them to fix this or we can copy their code-shiki package and do it ourselves.
Lexical bug: facebook/lexical#8515

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions