Closed martinRenou closed 1 year ago
Just checked with Voici 0.2.0 via the Voici Demo and it appears the Service Worker can't be found.
This looks like an issue with the base URL:
Checking with the demo
folder, it appears that the baseUrl
in the initial jupyter-config-data
is empty:
But manually setting "baseUrl": "/"
in the generated HTML seems to do the trick:
That empty string looks unexpected since there the baseUrl
is currently set to /
here:
As a comparison the themesUrl
defined here:
Appears to be defined correctly on the page:
@martinRenou do you know if the page config baseUrl
might be overridden at some other point during the export, maybe in an upstream exporter?
@martinRenou do you know if the page config baseUrl might be overridden at some other point during the export, maybe in an upstream exported?
It's not impossible that Voila itself overrides the baseUrl?
Right, I'm not exactly sure how the empty baseUrl
is ends up on the page:
However, this seems to be triggering the following code path in JupyterLab PageConfig
:
export function getOption(name: string): string {
if (configData) {
return configData[name] || getBodyData(name);
}
configData[name]
would be ""
, so the ||
triggers a call to getBodyData
. With getBodyData
getting the value from the body
data attribute:
Which voila
defines here: https://github.com/voila-dashboards/voila/blob/0f4cc5360ff387eeaf7e647cee712b2ce08d573a/share/jupyter/voila/templates/base/page.html#L23
<body data-base-url="{{ base_url }}voila/">
Most likely that's why there is a voila/
part in the URL:
Digging a bit more, Voila seems to be updating the page config baseUrl
with the one from the resources
in the template: https://github.com/voila-dashboards/voila/blob/0f4cc5360ff387eeaf7e647cee712b2ce08d573a/share/jupyter/voila/templates/lab/index.html.j2#L81
{# Set a dummy variable - we just want the side effect of the update. #}
{% set _ = page_config_full.update(baseUrl=resources.base_url, kernelId=kernel_id) %}
So if resources.base_url
is empty, that could explain why we always get "baseUrl": ""
.
Problem
JupyterLite can provide access to local files using a custom Emscripten File System, we should check that Voilite works properly with it