Skip to content

fix: resolve WASM CDN loading CORS issue and Vite compatibility#15

Merged
JSv4 merged 1 commit intomainfrom
JSv4/improve-npm-packaging
Nov 29, 2025
Merged

fix: resolve WASM CDN loading CORS issue and Vite compatibility#15
JSv4 merged 1 commit intomainfrom
JSv4/improve-npm-packaging

Conversation

@JSv4
Copy link
Copy Markdown
Owner

@JSv4 JSv4 commented Nov 29, 2025

Summary

  • Patch dotnet.js at build time to use credentials:"omit" instead of "same-origin", fixing CORS errors when loading WASM files from CDNs (jsDelivr, unpkg) that return Access-Control-Allow-Origin: * wildcard headers
  • Add @vite-ignore comment to dynamic import in npm/src/index.ts to prevent Vite from analyzing the WASM loader path during development builds

Test plan

  • Verified dotnet.js patch applied correctly (2 instances of credentials:"omit" replacing same-origin)
  • Verified TypeScript compiles without errors
  • Verified @vite-ignore comment present in compiled dist/index.js
  • Verified WASM rebuild successful (20MB bundle, 48 files)

Patch dotnet.js at build time to use credentials:"omit" instead of
"same-origin", fixing CORS errors when loading from CDNs that return
Access-Control-Allow-Origin: * wildcard headers.

Add @vite-ignore comment to dynamic import to prevent Vite from
analyzing the WASM loader path during development builds.
@JSv4 JSv4 merged commit a24012d into main Nov 29, 2025
4 checks passed
@JSv4 JSv4 deleted the JSv4/improve-npm-packaging branch November 29, 2025 05:44
JSv4 added a commit that referenced this pull request Dec 20, 2025
- Change ShadeCache in WmlToHtmlConverter to ConcurrentDictionary
- Change _unknownFonts in FontFamilyHelper to ConcurrentDictionary
- Use Lazy<T> for thread-safe lazy initialization of KnownFamilies
- Add ClearShadeCache() and ClearUnknownFontsCache() for memory management
- Add 3 concurrent conversion tests to verify thread-safety
- Update gaps documentation to mark issue #15 as fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant