You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/core/monaco-editor/vite-plugin/README.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,14 @@ A plugin to simplify loading the [Monaco Editor](https://github.com/microsoft/mo
4
4
5
5
This plugin also configures and loads the Monaco Editor web workers for you, so you don't need to manually set them up as described in the [official Monaco Editor ESM integration guide](https://github.com/microsoft/monaco-editor/blob/main/docs/integrate-esm.md#using-vite).
6
6
7
+
Since `@kong-public-ui/monaco-editor` uses [`@shikijs/monaco`](https://shiki.style/packages/monaco) to highlight Monaco Editor, this plugin also provides fine-grained control over the bundled languages and themes of shiki.
8
+
9
+
> [!IMPORTANT]
10
+
> `@kong-public-ui/monaco-editor` loads all the languages and features of Monaco Editor and all the corresponding languages of shiki by default, which significantly increases bundle size. Furthermore, since `@shikijs/monaco` integrates Shiki with Monaco Editor synchronously and loads all languages by default, it greatly increases Monaco Editor's initial loading time. It is strongly recommended to use this Vite plugin to reduce bundle size and improve loading performance by selectively including only the languages and features you need.
11
+
12
+
> [!TIP]
13
+
> This Vite plugin only needs to be applied in the consumer app. If you are developing a library based on Monaco Editor or `@kong-public-ui/monaco-editor`, you only need to externalize monaco-editor during the build.
14
+
7
15
## Usage
8
16
9
17
```ts
@@ -25,6 +33,10 @@ Options can be passed in to `@kong-ui-public/monaco-editor/vite-plugin`. They ca
25
33
26
34
-`customLanguages` (`{label:string; entry:string; worker:{id:string, entry:string} }[]`) - Custom languages (outside of the ones shipped with the `monaco-editor`), e.g. [monaco-yaml](https://github.com/remcohaszing/monaco-yaml).
-`langs` (`string[]`) - Languages to include for Shiki syntax highlighting. By default, uses the same languages specified in the `languages` option above.
38
+
-`themes` (`string[]`) - Themes to include for Shiki syntax highlighting. By default, `catppuccin-latte` and `catppuccin-mocha` are included.
0 commit comments