monaco-editor
monaco-editor copied to clipboard
fix: ts worker `customWorkerPath` error by exporting the `TypescriptWorker` class
This pr is meant to fix issue #3151 in which the TypescriptWorker class isn't exported, reducing the ability for devs to extend monaco in a module worker, as importScripts (which the customWorkerPath uses to extend the typescript worker) isn't available for module workers.
@hediet The importScript syntax doesn't work in esmodule workers, by allowing the TypeScript class to be exported I can make the TypeScript class work in esmodule workers even if the Monaco team doesn't officially support esmodule workers.
The problem is that customWorkerPath doesn't work in esmodule workers and unfortunately my situation requires that I use module workers.
@okikio Can you look into why CI fails?
@hediet For some reason the CI complains that esbuild hasn't been configured for .ttf files, but I never touch .ttf files in this pr
The CI on main is green though, thus the failure must be caused by this PR.
@hediet I've pushed a change to the package-esbuild.ts file that tells esbuild to treat the codicon.ttf file as an external file, from local testing it seems to fix the problem, but I'd need your opinion before confirming if the solution works.
Do you know why this problem happens here, but not in main?
I have no idea why it's doing this
I'm running into a similar issue. My codebase uses a custom TS Worker as well, e.g.:
import { TypeScriptWorker } from "monaco-editor/esm/vs/language/typescript/tsWorker";
export class CustomTypeScriptWorker extends TypeScriptWorker {
...
Which worked on 0.27.0, but fails after upgrading to the latest version
Any update on this one?
@camargo Thanks for reminding me, I'll look into this again
After a bunch of trial and error, I've determined that the cause of this issue is due to the exports being made, but I can't determine why the extra exports are causing the smoketests to fail
@camargo I'll need some help here as I'm unable to debug why the playwright tests keep crashing when I export functions that aren't create
Hi alexdima and okikio. We would love to use this feature if possible. Any ideas how to get this PR working? Happy to help get it through just need some guidance on where to start. Thanks!
@camargo The pr itself is working, it's the test that's broken and I can't figure out how to fix it
@alexdima Any advice on how to fix the test?
Getting this merged would be great for our project.
Is there any chance of getting this assigned to a monaco milestone?
Closing in favor of https://github.com/microsoft/monaco-editor/pull/4035