-
-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
I've been able to get through the tutorial and modify the browser DOM through compiled WASM, but have not had luck exporting swift code to javascript.
I'm using mainline swift, a downloaded swift-idk for WebAssembly, and main JavaScriptKit (4504e1).
$ swiftly run swift --version
Apple Swift version 6.2-dev (LLVM dec20e11e68da63, Swift 8a77cba10b78e6f)
Target: arm64-apple-macosx26.0
Build config: +assertions
$ export SWIFT_SDK_ID=swift-DEVELOPMENT-SNAPSHOT-2025-08-02-a_wasm
$ export JAVASCRIPTKIT_EXPERIMENTAL_BRIDGEJS=1
$ cd JavaScriptKit
$ make bootstrap
$ cd Examples/ExportSwift
$ swiftly run swift package --swift-sdk $SWIFT_SDK_ID js
$ npx serve
But I get an error in the browser console:
TypeError: Module name, '@bjorn3/browser_wasi_shim' does not resolve to a valid URL.
If I modify the browser.js
to reference this module in the node_modules directory, Chrome gives me the following error:
localhost/:1 Uncaught CompileError: WebAssembly.instantiateStreaming(): Duplicate export name 'swjs_library_features' for function 46 and function 817 @+2747
I'm not sure how to proceed at this point.
Metadata
Metadata
Assignees
Labels
No labels