I'd like to use the monaco editor on a website to demonstrate the use of a TS library that's distributed via npm. Moreover, I like to run the code from the editor inside my website context.
I managed already
- to use the monaco editor, in my case as a react component
- to get the transpiled output via
getTypeScriptWorkerand latergetEmitOutput
For now my monaco instance handles a singe file. Inside this file I'd like to import another library now.
What I found is the addExtraLib method. This is meant to include some d.ts definition files in the editor's intellisense. However, only the type definition files will not help me, as I need somehow everything in the outputted JavaScript.
So I know that TS is not a bundler, and maybe that's not even achievable with monaco. Would I then have to use the TS compiler API directly? I guess I'm not the first one trying to do this and I could not find anything about this on the web.
Does someone know of prior projects doing something like this or have any advice how to do that for me?