CodinGame / monaco-vscode-api

VSCode public API plugged on the monaco editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error When Using Extensions Override Service

cemalgnlts opened this issue · comments

Hi,

There is an error when using this service with arguments:

await initialize({
  ...getDefaultExtensionOverride(workerConfig),
});

Screenshot 2023-12-09 21 26 16

I created a project that only uses this package to see the error: https://stackblitz.com/edit/stackblitz-starters-sc18an

Hey! I've seen this error before, in my case it was happening because the extension host web worker could not be loaded. That was happening because it could not load vscode-semver, it was not properly deduplicated. I fixed it my adding "vscode-semver": "npm:semver@5.5.0" to the dependencies in package.json. Does that work for you?

Unfortunately, it did not solve the problem. Worker is running but for some reason it stops suddenly and I can't understand what's going on because it doesn't give me an error message.

Screen.recording.2023-12-13.11.48.19.webm

Yeah, that was a huge challenge for me as well at the time. Had to change the code to await import statements instead. Can you reproduce the same problem locally? Maybe WebContainers does some magic to support web workers and it isn't compatible with how we load them.

I got the error when running in local and started playing with the demo of the library.

That was the line that solved my problem:

optimizeDeps: {
+   include: ["vscode-semver"]
...
}

However, my example in WebContainer was giving an error even though I did this. This time I added the method you suggested:

dependencies: {
+  "vscode-semver": "npm:semver@5.5.0"
}

When I do both configurations: It's fully functional now.

Thanks.
(Although it took me 1 week, I'm glad it was solved.)