Skip to content

Commit

Permalink
Use relative paths for ctx.importScripts() (#13854)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sgraband committed Jul 3, 2024
1 parent 5a8d3cf commit 69b8877
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/hosted/browser/worker/worker-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const pluginsModulesNames = new Map<string, Plugin>();
const scripts = new Set<string>();

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

if (!scripts.has(path)) {
ctx.importScripts(path);
Expand All @@ -70,7 +70,7 @@ pluginManager.setPluginHost({
ctx.frontendModuleName = plugin.lifecycle.frontendModuleName;
}

ctx.importScripts('/hostedPlugin/' + getPluginId(plugin.model) + '/' + plugin.pluginPath);
ctx.importScripts('./hostedPlugin/' + getPluginId(plugin.model) + '/' + plugin.pluginPath);
}
}

Expand Down

0 comments on commit 69b8877

Please sign in to comment.