microsoft / live-share

Real-time collaborative development from the comfort of your favorite tools
http://aka.ms/vsls
Creative Commons Attribution 4.0 International
2.27k stars 248 forks source link

`vsls.getAPI()` returns `null` if extension is bundled #5045

Open ejgallego opened 5 months ago

ejgallego commented 5 months ago

Dear VSLS devs,

Describe what happened:

I was trying to add support for Live Share to the coq-lsp extension, however I am finding some puzzling error: basically, if I bundle my extension with WebPack or esbuild, vsls.getAPI() will always resolve to null.

If instead, I chose not to bundle the extension, things seem to work.

Is that a known problem? Let me know if you need more information, including a fully reproducible setup (the trivial extension that calls getAPI suffices)

What was your system configuration?

Product and Version [VS/VSCode]: VSCode 1.88.0 OS Version[macOS/Windows]: Linux (Ubuntu 22.04) Live Share Extension Version: v1.0.5918 Target Platform or Language [e.g. Node.js]: VSCode Extensions

Steps to Reproduce / Scenario:

  1. Write a simple extension that calls vsls.getAPI()
  2. Build with tsc -b . , vsls.getAPI() works
  3. Build with a bundler (tried esbuild 0.16, 0.20, webpack), vsls.getAPI() returns null
Jason3S commented 4 months ago

@ejgallego,

This seems to be a known issue. Even MS has a workaround:

image

https://github.com/microsoft/vscode-pull-request-github/blob/f8f644659c1397bbb1484f4bf8c1524815983ba9/src/gitProviders/vsls.ts#L13