[browser][MT] fix different url base of the worker (#86863)
authorPavel Savara <pavel.savara@gmail.com>
Mon, 29 May 2023 17:09:19 +0000 (19:09 +0200)
committerGitHub <noreply@github.com>
Mon, 29 May 2023 17:09:19 +0000 (19:09 +0200)
* fix different url base of the worker

src/mono/wasm/runtime/loader/blazor/_Integration.ts
src/mono/wasm/runtime/types/index.ts

index 47d9af0..d245991 100644 (file)
@@ -107,13 +107,13 @@ export function mapBootConfigToMonoConfig(moduleConfig: MonoConfigInternal, appl
     for (const name in resources.runtimeAssets) {
         const asset = resources.runtimeAssets[name] as AssetEntry;
         asset.name = name;
-        asset.resolvedUrl = `_framework/${name}`;
+        asset.resolvedUrl = loaderHelpers.locateFile(name);
         assets.push(asset);
     }
     for (const name in resources.assembly) {
         const asset: AssetEntry = {
             name,
-            resolvedUrl: `_framework/${name}`,
+            resolvedUrl: loaderHelpers.locateFile(name),
             hash: resources.assembly[name],
             behavior: "assembly",
         };
@@ -123,7 +123,7 @@ export function mapBootConfigToMonoConfig(moduleConfig: MonoConfigInternal, appl
         for (const name in resources.pdb) {
             const asset: AssetEntry = {
                 name,
-                resolvedUrl: `_framework/${name}`,
+                resolvedUrl: loaderHelpers.locateFile(name),
                 hash: resources.pdb[name],
                 behavior: "pdb",
             };
@@ -149,7 +149,7 @@ export function mapBootConfigToMonoConfig(moduleConfig: MonoConfigInternal, appl
             continue;
         }
 
-        const resolvedUrl = name.endsWith(".js") ? `./${name}` : `_framework/${name}`;
+        const resolvedUrl = loaderHelpers.locateFile(name);
         const asset: AssetEntry = {
             name,
             resolvedUrl,
@@ -163,7 +163,7 @@ export function mapBootConfigToMonoConfig(moduleConfig: MonoConfigInternal, appl
         if (config === "appsettings.json" || config === `appsettings.${applicationEnvironment}.json`) {
             assets.push({
                 name: config,
-                resolvedUrl: config,
+                resolvedUrl: (document ? document.baseURI : "/") + config,
                 behavior: "vfs",
             });
         }
index 12815fa..1d0a721 100644 (file)
@@ -92,7 +92,7 @@ export type MonoConfig = {
 export interface ResourceRequest {
     name: string, // the name of the asset, including extension.
     behavior: AssetBehaviours, // determines how the asset will be handled once loaded
-    resolvedUrl?: string;
+    resolvedUrl?: string; // this should be absolute url to the asset
     hash?: string;
 }