Skip to content

Commit 5e56cbc

Browse files
Copilotjaviercn
andcommitted
Add cache busting query string to dotnet.js import statements
Co-authored-by: javiercn <[email protected]>
1 parent 878e7a8 commit 5e56cbc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ async function importDotnetJs(startOptions: Partial<WebAssemblyStartOptions>): P
170170
// Allow overriding the URI from which the dotnet.*.js file is loaded
171171
if (startOptions.loadBootResource) {
172172
const resourceType: WebAssemblyBootResourceType = 'dotnetjs';
173+
<<<<<<< HEAD
173174
const customSrc = startOptions.loadBootResource(resourceType, 'dotnet.js', src, '', 'js-module-dotnet');
175+
=======
176+
const customSrc = startOptions.loadBootResource(resourceType, 'dotnet.js', `_framework/dotnet.js?v=${Date.now()}`, '', 'js-module-dotnet');
177+
>>>>>>> 69bee3a6fc (Add cache busting query string to dotnet.js import statements)
174178
if (typeof (customSrc) === 'string') {
175179
src = customSrc;
176180
} else if (customSrc) {
@@ -179,8 +183,13 @@ async function importDotnetJs(startOptions: Partial<WebAssemblyStartOptions>): P
179183
}
180184
}
181185

186+
<<<<<<< HEAD
182187
const absoluteSrc = (new URL(src, document.baseURI)).toString();
183188
return await import(/* webpackIgnore: true */ absoluteSrc);
189+
=======
190+
// @ts-ignore: This dynamic import is handled at runtime and does not need a type declaration.
191+
return await import(/* webpackIgnore: true */ `./dotnet.js?v=${Date.now()}`);
192+
>>>>>>> 69bee3a6fc (Add cache busting query string to dotnet.js import statements)
184193
}
185194

186195
function prepareRuntimeConfig(options: Partial<WebAssemblyStartOptions>, onConfigLoadedCallback?: (loadedConfig: MonoConfig) => void): DotnetModuleConfig {

0 commit comments

Comments
 (0)