diff --git a/src/mono/wasm/runtime/dotnet.d.ts b/src/mono/wasm/runtime/dotnet.d.ts index 31f53dff810341..7d738d25a75c24 100644 --- a/src/mono/wasm/runtime/dotnet.d.ts +++ b/src/mono/wasm/runtime/dotnet.d.ts @@ -182,11 +182,12 @@ type MonoConfig = { [name: string]: any; }; /** - * This is current working directory for the runtime on the virtual file system. Default is "/". + * This is initial working directory for the runtime on the virtual file system. Default is "/". */ virtualWorkingDirectory?: string; /** - * This is the arguments to the Main() method of the program. Default is []. + * This is the arguments to the Main() method of the program when called with dotnet.run() Default is []. + * Note: RuntimeAPI.runMain() and RuntimeAPI.runMainAndExit() will replace this value, if they provide it. */ applicationArguments?: string[]; }; diff --git a/src/mono/wasm/runtime/loader/assets.ts b/src/mono/wasm/runtime/loader/assets.ts index 77f54ebc30c1d3..cc864a439afe4e 100644 --- a/src/mono/wasm/runtime/loader/assets.ts +++ b/src/mono/wasm/runtime/loader/assets.ts @@ -127,19 +127,21 @@ function get_single_asset(behavior: SingleAssetBehaviors): AssetEntryInternal { export function resolve_single_asset_path(behavior: SingleAssetBehaviors): AssetEntryInternal { const asset = get_single_asset(behavior); - asset.resolvedUrl = loaderHelpers.locateFile(asset.name); - - if (jsRuntimeModulesAssetTypes[asset.behavior]) { - // give loadBootResource chance to override the url for JS modules with 'dotnetjs' type - const customLoadResult = invokeLoadBootResource(asset); - if (customLoadResult) { - mono_assert(typeof customLoadResult === "string", "loadBootResource response for 'dotnetjs' type should be a URL string"); - asset.resolvedUrl = customLoadResult; - } else { - asset.resolvedUrl = appendUniqueQuery(asset.resolvedUrl, asset.behavior); + if (!asset.resolvedUrl) { + asset.resolvedUrl = loaderHelpers.locateFile(asset.name); + + if (jsRuntimeModulesAssetTypes[asset.behavior]) { + // give loadBootResource chance to override the url for JS modules with 'dotnetjs' type + const customLoadResult = invokeLoadBootResource(asset); + if (customLoadResult) { + mono_assert(typeof customLoadResult === "string", "loadBootResource response for 'dotnetjs' type should be a URL string"); + asset.resolvedUrl = customLoadResult; + } else { + asset.resolvedUrl = appendUniqueQuery(asset.resolvedUrl, asset.behavior); + } + } else if (asset.behavior !== "dotnetwasm") { + throw new Error(`Unknown single asset behavior ${behavior}`); } - } else if (asset.behavior !== "dotnetwasm") { - throw new Error(`Unknown single asset behavior ${behavior}`); } return asset; }