Skip to content

Commit 69b8877

Browse files
authored
Use relative paths for ctx.importScripts() (#13854)
Before we tried to load absolute paths e.g. `/context/`. This is a problem, when working in deployed use cases, where Theia might be hosted under a path (e.g. try.theia-cloud.io). Because then the loaded path will be from the root of the page and not, like wanted, from the current path. Simply changing it to relative paths (e.g. `./context/`) solves this issue. Fixes #13813
1 parent 5a8d3cf commit 69b8877

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/plugin-ext/src/hosted/browser/worker/worker-main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const pluginsModulesNames = new Map<string, Plugin>();
4545
const scripts = new Set<string>();
4646

4747
function initialize(contextPath: string, pluginMetadata: PluginMetadata): void {
48-
const path = '/context/' + contextPath;
48+
const path = './context/' + contextPath;
4949

5050
if (!scripts.has(path)) {
5151
ctx.importScripts(path);
@@ -70,7 +70,7 @@ pluginManager.setPluginHost({
7070
ctx.frontendModuleName = plugin.lifecycle.frontendModuleName;
7171
}
7272

73-
ctx.importScripts('/hostedPlugin/' + getPluginId(plugin.model) + '/' + plugin.pluginPath);
73+
ctx.importScripts('./hostedPlugin/' + getPluginId(plugin.model) + '/' + plugin.pluginPath);
7474
}
7575
}
7676

0 commit comments

Comments
 (0)