Description
We updated to macOS Sequoia and are trying to get SwiftWasm working again in this environment.
After installing a Swift release toolchain (6.0.1) and a matching SwiftWasm SDK, we are able to build our Swift package, with some changes.
swift.setInstance(instance);
wasi.initialize(instance);
swift.main(); // <-- new
runCmd(
"swift",
[
"build",
"--swift-sdk", // <-- new
"6.0-SNAPSHOT-2024-08-30-a-wasm32-unknown-wasi", // <-- new
// "--skip-update", // for offline support
"-c",
BUILD_CONFIG,
"--product",
PRODUCT_NAME,
"-Xswiftc",
"-Xclang-linker",
"-Xswiftc",
"-mexec-model=reactor",
"-Xlinker",
"--export-if-defined=main",
"-Xlinker",
"--export-if-defined=__main_argc_argv", // <-- new
"-Xswiftc",
"-DJAVASCRIPTKIT_WITHOUT_WEAKREFS",
],
{
cwd: swiftPackageDir,
env: { ...process.env, TOOLCHAINS: "Swift 6.0.1" }, // <-- new
shell: true,
stdio: "inherit",
}
);
After the above changes, almost everything works as expected.
Now here is the issue: previously we had issues with JavaScriptKit using resources
in its target definition (in Package.swift) under certain circumstances – I think because we were using an API that "might" be provided by Foundation if it's imported (note that the resources
flag depends on Foundation
, see here).
This happens due to this line:
.target(
name: "JavaScriptKit",
dependencies: ["_CJavaScriptKit"],
resources: [.copy("Runtime")] // <-- here
),
Now it seems we can't escape it. I can remove the resources
line and the package will build fine, but doing so would require a fork of JavaScriptKit to get reproducible builds. Do you have any idea what could be going on here? Have you seen this issue yourself at all?

To be clear: we don't want or need Foundation at all in our project. It is being automatically imported due to the resources
line in JavaScriptKit's Package.swift. I can't see how to workaround this any more in Swift 6.x: it seems like something has changed such that whenever resources
is there, Foundation is required. Any ideas?