microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.42k stars 28.62k forks source link

Welcome: need a different approach of loading content from `walkthroughMetadata` #225477

Closed bpasero closed 1 week ago

bpasero commented 1 month ago

We are currently working on changing our code loading away from AMD to ESM. One thing I did notice is that welcome seems to have a way of loading steps or content via a contributable mechanism that works by require of said content as module. When we are running with ESM, we no longer have a require function to load these modules:

https://github.com/microsoft/vscode/blob/922413f6d97e16c05b565398f33d95c306b1ceb7/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedDetailsRenderer.ts#L224-L228

https://github.com/microsoft/vscode/blob/922413f6d97e16c05b565398f33d95c306b1ceb7/src/vs/workbench/contrib/welcomeWalkthrough/common/walkThroughContentProvider.ts#L31-L37

I pushed a workaround for the usages we have in core to make it work through some kind of simple registry: https://github.com/microsoft/vscode/pull/166033/commits/42c2694f3d3bb7415725ba6dd6324335451530e8

I could not find other uses but assume this maybe something that web embedders can provide?

//cc @jrieken

bpasero commented 3 weeks ago

@bhavyaus 👋

bhavyaus commented 2 weeks ago

I'll investigate a fix for after endgame duties this week.

bhavyaus commented 2 weeks ago

Confirmed that this code path is only for loading our interactive walkthrough content such as the interactive playground and the theme picker in our built-in walkthrough. This code path does not run for extension walkthroughs.

@bpasero given that the imported modules are built-in, could we leverage dynamic imports with a simpler fix like: https://github.com/microsoft/vscode/pull/227251