Skip to content

Support for lazy loading of split bundles in pre-load scripts for Notebooks #98106

Closed
@DonJayamanne

Description

@DonJayamanne

Preloading scripts works as expected in output renderes. However if the preload script is a bundle that lazyloads other bundle scripts, then this doesn't work.

The reason this doesn't work is because WebPack will attempt to load the resource dynamically. However this can only be done if resources are using the vscode-resource scheme (which cannot be hardcoded).

Current approach in Python webiview notebook implementation

  • We make use of __webpack_public_path__ variable, this is initialized to a global variable window.__PVSC_Public_Path
  • In our webivew we initialize the above value as follows:
    window.__PVSC_Public_Path = "${webView.asWebviewUri(Uri.file(<Extension dir/xyz>)).toString()}/";

This option will not work with preload scripts for notebooks

  • At the moment the only solution I can see is to dynamically generate a JS file with the above code in it
  • Ensure the above JS file is preloaded first

Again, this might not work well

  • Output renderers do not have access to asWebViewUri method, hence any attempt to generate this value based on active Notebook Editor is not guaranteed to work.
  • We (extension authors) cannot assume this value is a constant across all webviews

@rebornix /cc

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions