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: README.md
+60-4
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,7 @@ The examples not requiring a backend are now available [via GitHub Pages](https:
62
62
-[Bad Polyfills](#bad-polyfills)
63
63
-[buffer](#buffer)
64
64
-[monaco-editor and react](#monaco-editor-and-react)
65
+
-[webpack worker issues](#webpack-worker-issues)
65
66
-[Licenses](#licenses)
66
67
67
68
## Changelogs, project history and compatibility
@@ -76,7 +77,18 @@ CHANGELOGs for each project are available from the linked location:
76
77
77
78
Important Project changes and notes about the project's history are found [here](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/versions-and-history.md#important-project-changes).
78
79
79
-
You find the `monaco-editor`, `vscode`, `@codingame/monaco-vscode-api` and `@codingame/monaco-vscode-editor-api` compatibility table [here](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/versions-and-history.md#monaco-editor--codingamemonaco-vscode-api-compatibility-table).
80
+
These are the current versions of packages from this repository and their alignment with **@codingame/monaco-vscode-api****monaco-editor** and **vscode**:
You find the full compatibility table with all previous versions [here](https://github.com/TypeFox/monaco-languageclient/blob/main/docs/versions-and-history.md#monaco-editor--codingamemonaco-vscode-api-compatibility-table).
80
92
81
93
[This article](https://www.typefox.io/blog/teaching-the-language-server-protocol-to-microsofts-monaco-editor/) describes the initial motivation for starting monaco-languageclient.
82
94
@@ -244,12 +256,12 @@ Whenever you used `monaco-editor`/`@codingame/monaco-vscode-editor-api` `vscode`
244
256
If you use pnpm or yarn, you have to add `vscode` / `@codingame/monaco-vscode-api` as direct dependency, otherwise the installation will fail:
When you use the libraries from this project you are no longer are required to proxy `monaco-editor` like `"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~15.0.2"` in you `package.json`. You can directly use it like this:
264
+
When you use the libraries from this project you are no longer are required to proxy `monaco-editor` like `"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~15.0.3"` in you `package.json`. You can directly use it like this:
@@ -330,6 +342,50 @@ import { loader } from "@monaco-editor/react";
330
342
loader.config({ monaco });
331
343
```
332
344
345
+
### webpack worker issues
346
+
347
+
When webpack is used as bundler there are issues with utilizing the undbundled workers from `@codingame/monaco-vscode-api`. [jhk-mjolner](https://github.com/jhk-mjolner) provided a solution in the context of issue #853 [here](https://github.com/TypeFox/monaco-languageclient/issues/853#issuecomment-2709959822):
348
+
349
+
1. Npm install `webpack-cli` (or webpack will do it for you when you try running this later).
350
+
2. Create a `bundle-monaco-workers.js` file with this content:
351
+
352
+
```js
353
+
// solve: __dirname is not defined in ES module scope
// if this is true (default), webpack will produce code trying to access global `document` variable for the textmate worker, which will fail at runtime due to being a worker
369
+
chunkLoading: false
370
+
},
371
+
mode: 'production',
372
+
performance: {
373
+
hints: false
374
+
}
375
+
};
376
+
```
377
+
378
+
3. Add this line to your `packages.json` scripts section: `"bundle monaco workers": "webpack --config bundle-monaco-workers.js"`
379
+
4. Run the script `npm run 'bundle monaco workers'`
380
+
5. Configure the `workerLoaders` parameter for `useWorkerFactory` to point to the pre-bundled workers:
381
+
382
+
```js
383
+
'TextEditorWorker': () => new Worker('/assets/monaco-workers/editor.js', {type: 'module'}),
384
+
'TextMateWorker': () => new Worker('/assets/monaco-workers/textmate.js', {type: 'module'}),
385
+
```
386
+
387
+
6. Enable `editor.experimental.asyncTokenization` in the monaco-wrapper config, if you want to use the textmate worker.
0 commit comments