facebook / facebook/lexical

Feature: Example of Vite config to fully bundle lexical+plugins+react into a JS and a CSS file

Open
#6,175 16 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 16h
Merged PRs (30d)
61

Description

I'm developing a single-file HTML app (for ease of distribution and drop-in) which needs a rich-text editor. I'm currently using Lexical for this purpose.

Extracting one of asks from https://github.com/facebook/lexical/issues/5840, for non-webdevs like me, it would be greate to have an example of Vite config bundling Lexical+Plugins+React into:

1) one JS and one CSS file - e.g. for deployment to GitHub pages (the existing vite config produces many CSS/font/image/JS files)
2) the JS/CSS should be fully embeddable in `...` and `...` and it should be possible to somehow register a Promise to be triggered when initialization of the editor completes (and ideally also a synchronous initialization should be supported)

Am I correct that (1) should already be achievable in https://vitejs.dev/guide/build#library-mode ?

Contributor guide

Open the contributing guide

Research direction

Review the existing Vite configuration and the Vite library-mode guide linked in the issue. Determine how to produce one embeddable JavaScript file and one CSS file for Lexical, its plugins, and React, including completion signaling; done means a documented example that works for the stated single-file HTML deployment.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, vite
Domain
build-system, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.