File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed
src/Uno.Wasm.Bootstrap/Embedded Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -33,14 +33,24 @@ if (unoConfig.environmentVariables["UNO_BOOTSTRAP_DEBUGGER_ENABLED"] !== "True")
33
33
// existing cached content from the runtime as the keys contain a
34
34
// hash we cannot reliably compute.
35
35
try {
36
- var c = await import ( "$(REMOTE_WEBAPP_PATH)_framework/dotnet.boot.js" ) ;
37
- // Response validation to catch HTTP errors early
38
- // This prevents trying to parse invalid JSON from error responses
39
- if ( ! c . ok ) {
40
- throw new Error ( `Failed to fetch blazor.boot.json: ${ c . status } ${ c . statusText } ` ) ;
36
+ // Replace dynamic import with fetch and eval for web worker compatibility
37
+ const response = await fetch ( "$(REMOTE_WEBAPP_PATH)_framework/dotnet.boot.js" ) ;
38
+ if ( ! response . ok ) {
39
+ throw new Error ( `Failed to fetch dotnet.boot.js: ${ response . status } ${ response . statusText } ` ) ;
41
40
}
42
41
43
- const bootJson = await c . default . config ;
42
+ let scriptContent = await response . text ( ) ;
43
+
44
+ const match = scriptContent . match ( / .* ?\/ \* j s o n - s t a r t \* \/ ( [ \s \S ] * ?) \/ \* j s o n - e n d \* \/ / ) ;
45
+
46
+ // If found, wrap it with parentheses so eval can treat it as an object literal
47
+ const c = match ? `(${ match [ 1 ] } )` : null ;
48
+
49
+ if ( ! c ) {
50
+ throw `Invalid config` ;
51
+ }
52
+
53
+ const bootJson = eval ( c ) ;
44
54
const monoConfigResources = bootJson . resources || { } ;
45
55
46
56
var entries = {
You can’t perform that action at this time.
0 commit comments