# Swift for Wasm Q3 2025 Updates

**URL:** <https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956>\
**Category:** Swift for WebAssembly\
**Created:** [September 4, 2025, 9:51am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956 "2025-09-04T09:51:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max\_Desiatov](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/max_desiatov/32/20654_2.png) [@Max\_Desiatov](https://forums.swift.org/u/Max_Desiatov)\
**Post date:** [September 4, 2025, 9:51am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/1 "2025-09-04T09:51:12Z")

</div>

Since official support for Wasm in Swift 6.2 was announced at WWDC this year, Swift contributors have done a huge amount of work. To provide better visibility and to track progress, here’s a list of notable changes:

- Breaking change: `wasm32-unknown-wasi` triple wasm [renamed](https://github.com/swiftlang/swift/pull/83167) to `wasm32-unknown-wasip1`. The `p1` suffix explicitly indicates [WASI](https://wasi.dev/) Preview 1, which helps distinguish it from the newer WASI Preview 2 (`wasip2`) and provides clarity about which version of the WASI specification is being targeted.

- Embedded Swift concurrency is now enabled for CLI executables (compatible with `swift run`) built with `main` development snapshots of the Swift toolchain. Some `async` stdlib functions, [such as `Task.sleep`](https://github.com/swiftlang/swift/issues/84058) are not available yet.

- Embedded Swift concurrency can also be used in browser applications that utilize `JavaScriptEventLoop` from the [`JavaScriptKit`](https://github.com/swiftwasm/JavaScriptKit) library, [as demonstrated in the `WebGPUDemo` example package](https://github.com/swiftlang/swift-for-wasm-examples/pull/44).

- `swiftlang/github-workflows` now support Swift SDKs for Wasm controlled by [`enable_wasm_sdk_build`](https://github.com/swiftlang/github-workflows/pull/142) and [`enable_embedded_wasm_sdk_build`](https://github.com/swiftlang/github-workflows/pull/150) configuration settings. This enabled Wasm CI jobs merged or in review now for multiple libraries: [swift-algorithms](https://github.com/apple/swift-algorithms/pull/261), [swift-async-algorithms](https://github.com/apple/swift-async-algorithms/pull/363), [swift-argument-parser](https://github.com/apple/swift-argument-parser/pull/794), [swift-atomics](https://github.com/apple/swift-atomics/pull/124), [swift-collections](https://github.com/apple/swift-collections/pull/509), [swift-foundation](https://github.com/swiftlang/swift-foundation/pull/1461), [swift-crypto](https://github.com/apple/swift-crypto/pull/405), [swift-log](https://github.com/apple/swift-log/pull/371), [swift-nio](https://github.com/apple/swift-nio/pull/3332), [swift-numerics](https://github.com/apple/swift-numerics/pull/325), [swift-syntax](https://github.com/swiftlang/swift-syntax/pull/3135), and [swift-system](https://github.com/apple/swift-system/pull/253).

- Wasm plugin has been added to upstream LLDB (soon to be available in [Swift LLVM 21 rebranch](https://forums.swift.org/t/updating-llvm-project-branch-for-swift-main-stable-21-x/81184)) in a series of PRs: [#150143](https://github.com/llvm/llvm-project/pull/150143), [#151445](https://github.com/llvm/llvm-project/pull/151445), [#151056](https://github.com/llvm/llvm-project/pull/151056), [#151010](https://github.com/llvm/llvm-project/pull/151010).

- Swift SDK for Wasm [now includes Foundation](https://github.com/swiftlang/swift/pull/82285) in both `main` and 6.2 development snapshots. Note that Foundation isn’t supported in Embedded Swift yet.

- [WasmKit 0.1.6](https://github.com/swiftwasm/WasmKit/releases/tag/0.1.6) added Android support and dropped Swift 5.9 support.

- JavaScriptKit had multiple releases in the 0.31...0.35 range with numerous changes:

- Created [a public Swift for Wasm GitHub project board](https://github.com/orgs/swiftlang/projects/23) on the `swiftlang` GitHub organization.

- Added [`DOMRefTypes` example](https://github.com/swiftlang/swift-for-wasm-examples/pull/41) to `swift-for-wasm-examples`, showing advanced use of Wasm reference types via C interop.

- [Fixed](https://github.com/swiftlang/swift/pull/83792) [“`import WASILibc` is unavailable in Embedded Swift for WASI”](https://github.com/swiftlang/swift/issues/83513).

- [Fixed incorrect `va_list` C interop behavior](https://github.com/swiftlang/swift/pull/84029) when using WASI-libc.

Surely I missed a few changes in this list unintentionally, so please feel free to post what you found notable in this thread. Many thanks to all of the contributors pushing the ecosystem forward!

---

<div class="post-metadata">

**Author:** ![sliemeobn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sliemeobn/32/27698_2.png) [@sliemeobn](https://forums.swift.org/u/sliemeobn)\
**Post date:** [September 4, 2025, 10:53am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/2 "2025-09-04T10:53:47Z")

</div>

(ง^\_^)ง LET'S GOOO!!!

---

<div class="post-metadata">

**Author:** ![xtremekforever](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/xtremekforever/32/43018_2.png) [@xtremekforever](https://forums.swift.org/u/xtremekforever)\
**Post date:** [September 5, 2025, 3:21pm UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/3 "2025-09-05T15:21:16Z")

</div>

This is very cool. I really need to try out some WASM stuff soon if just to play with it!

---

<div class="post-metadata">

**Author:** ![austintatious](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@austintatious](https://forums.swift.org/u/austintatious)\
**Post date:** [September 8, 2025, 4:28am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/4 "2025-09-08T04:28:38Z")

</div>

Are there any plans for Carton?

---

<div class="post-metadata">

**Author:** ![kateinoigakukun](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kateinoigakukun/32/16706_2.png) [@kateinoigakukun](https://forums.swift.org/u/kateinoigakukun)\
**Post date:** [September 8, 2025, 4:37am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/5 "2025-09-08T04:37:51Z")

</div>

We are soft-deprecating Carton in favor of [`swift package js` SwiftPM Package Plugin provided by JavaScriptKit](https://swiftpackageindex.com/swiftwasm/javascriptkit/0.35.0/tutorials/javascriptkit/hello-world), which just generates an ES Module + .wasm file. You can still use Carton for now, but I no longer have any further plans to invest in Carton for now.

---

<div class="post-metadata">

**Author:** ![austintatious](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@austintatious](https://forums.swift.org/u/austintatious)\
**Post date:** [September 8, 2025, 4:55am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/6 "2025-09-08T04:55:40Z")

</div>

I see. What are the plans for the debugging features?

---

<div class="post-metadata">

**Author:** ![kateinoigakukun](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kateinoigakukun/32/16706_2.png) [@kateinoigakukun](https://forums.swift.org/u/kateinoigakukun)\
**Post date:** [September 8, 2025, 4:57am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/7 "2025-09-08T04:57:48Z")

</div>

We actually added enhanced Swift support in the Wasm debugging extension for Chrome DevTools early this year: [Debugging - Swift and WebAssembly](https://book.swiftwasm.org/getting-started/debugging.html#enhanced-dwarf-extension-for-swift)

 ![image](https://global.discourse-cdn.com/swift/original/3X/8/e/8eb117384bfbe990832c1119b303b135e7747cd6.jpeg)

---

<div class="post-metadata">

**Author:** ![austintatious](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@austintatious](https://forums.swift.org/u/austintatious)\
**Post date:** [September 8, 2025, 5:15am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/8 "2025-09-08T05:15:36Z")

</div>

I see. So that feature wasn’t necessarily required to be used with Carton. I apologize. I feel like I have been updating and changing how I build my project that I have lost track of where all the parts come into play. I have stayed with 5.10 so I can keep using carton. But I gotta move to 6.1+, so now I’m trying to move to whatever the newest way to do things is. I just finished building a new Ubuntu VM to test. The project compiled fine using the instructions form the page your provided.

Is there a mechanism to run 'wasm-opt’ after it is built?

---

<div class="post-metadata">

**Author:** ![kateinoigakukun](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kateinoigakukun/32/16706_2.png) [@kateinoigakukun](https://forums.swift.org/u/kateinoigakukun)\
**Post date:** [September 8, 2025, 5:17am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/9 "2025-09-08T05:17:20Z")

</div>

Yes, `swift package js -c release` automatically applies wasm-opt after the build if the tool is installed.

---

<div class="post-metadata">

**Author:** ![austintatious](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@austintatious](https://forums.swift.org/u/austintatious)\
**Post date:** [September 8, 2025, 5:18am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/10 "2025-09-08T05:18:18Z")

</div>

I see. So the tool _is_ installed. But the binary is at 120mb (should be like 20mb after wasm-opt). Is the stripped file being moved somewhere else? I guess, what I mean is there a folder like “Bundle” that is being created somewhere?

---

<div class="post-metadata">

**Author:** ![kateinoigakukun](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kateinoigakukun/32/16706_2.png) [@kateinoigakukun](https://forums.swift.org/u/kateinoigakukun)\
**Post date:** [September 8, 2025, 5:27am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/11 "2025-09-08T05:27:45Z")

</div>

1. Hmm, if you build with release configuration, debug symbols should be stripped unless you explicitly pass `--debug-info-format` option. Can you share your build command?
2. The "Bundle" directory is generated under `.build/plugins/PackageToJS/outputs/Package` by default. If you pass `--output` option with `--allow-writing-to-package-directory` plugin option, you can keep the existing directory layout:

```console
$ swift package --swift-sdk "${SWIFT_SDK_ID}" -c release plugin --allow-writing-to-package-directory js --output ./Bundle

```

---

<div class="post-metadata">

**Author:** ![austintatious](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@austintatious](https://forums.swift.org/u/austintatious)\
**Post date:** [September 8, 2025, 5:34am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/12 "2025-09-08T05:34:50Z")

</div>

I was just building with

`swift package --swift-sdk 6.1-RELEASE-wasm32-unknown-wasi js --use-cdn`

I used your suggested command (which is a life saver thank you!)

`$ swift package --swift-sdk 6.1-RELEASE-wasm32-unknown-wasi -c release plugin --allow-writing-to-package-directory js --output ./Bundle`

The .wasm file is now 50mb. Still not the almost 20mb it was when building with 5.10 and Carton.

Is there an optimization option that I could pass?

---

<div class="post-metadata">

**Author:** ![kateinoigakukun](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kateinoigakukun/32/16706_2.png) [@kateinoigakukun](https://forums.swift.org/u/kateinoigakukun)\
**Post date:** [September 8, 2025, 5:37am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/13 "2025-09-08T05:37:18Z")

</div>

The major binary size difference in the recent versions is ICU data. Recent Foundation brought full-featured ICU data into our binary, so you might be able to reduce the size into what we had before by replacing the data with slimmed version: [GitHub - GoodNotes/swift-icudata-slim: A slimmed-down version of ICU for Swift](https://github.com/GoodNotes/swift-icudata-slim)

---

<div class="post-metadata">

**Author:** ![austintatious](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@austintatious](https://forums.swift.org/u/austintatious)\
**Post date:** [September 8, 2025, 5:52am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/14 "2025-09-08T05:52:11Z")

</div>

I did not realize at all that the increase in ICU data would cause an approaching 30MB (I fathom that some of the size increase is from other stuff too?) . I suppose it is not awful. The site will just take about twice as long to load, which given the niche-ness of it that is ok.

Lastly is there an argument to get the `index.html` file to copy into the ./Bundle folder? Other than that (which I can definitely do myself), this looks like it is going to be mostly a good replacement.

---

<div class="post-metadata">

**Author:** ![kateinoigakukun](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kateinoigakukun/32/16706_2.png) [@kateinoigakukun](https://forums.swift.org/u/kateinoigakukun)\
**Post date:** [September 8, 2025, 5:57am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/15 "2025-09-08T05:57:06Z")

</div>

I think you actually don't need to copy index.html to ./Bundle. Instead, you can:

```swift
$ mkdir dist
$ cat <<EOS > dist/index.html
<!DOCTYPE html>
<html>
<body>
  <script type="module">
    import { init } from "./Bundle/index.js";
    init();
  </script>
</body>
</html>
EOS
$ swift package js --output ./dist/Bundle
$ echo "./dist/Bundle" >> .gitignore
$ # Serve ./dist by your HTTP server

```

---

<div class="post-metadata">

**Author:** ![austintatious](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@austintatious](https://forums.swift.org/u/austintatious)\
**Post date:** [September 8, 2025, 10:58pm UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/16 "2025-09-08T22:58:10Z")

</div>

So I am a little confused, when I do `--wasm-optimizations none` with Carton on 5.10, the resulting binary is only about 32MB (with optimization it is about 20MB), but when I run it using the new method under 6.1 the resulting binary is larger than when there is no optimization at all on the old version.

I am wondering if something else is happening here that I am either skipping or missing. Like maybe certain unused functions are not being stripped?

Surly it isn't all ICU tables? Is it?

---

<div class="post-metadata">

**Author:** ![kateinoigakukun](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kateinoigakukun/32/16706_2.png) [@kateinoigakukun](https://forums.swift.org/u/kateinoigakukun)\
**Post date:** [September 9, 2025, 2:05am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/17 "2025-09-09T02:05:37Z")

</div>

If you can provide me a reproducible example, I can take a closer look 🙏

---

<div class="post-metadata">

**Author:** ![7ombie](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/7ombie/32/36317_2.png) [@7ombie](https://forums.swift.org/u/7ombie)\
**Post date:** [September 17, 2025, 11:10pm UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/18 "2025-09-17T23:10:02Z")

</div>

Do I have to use WASI?

I was hoping that Embedded Swift (in the browser) would be able to (directly) import JS functions (as if they're written in C), export Swift functions (that can then be invoked by JavaScript) and use pointers for memory mapped IO. At least, something like that.

In short, I’d like to use Swift instead of WAT (which doesn’t require WASI). I don't know exactly how the API would work; I just assumed it'd be an option. Embedded Swift doesn't require an OS, so shouldn't really need WASI, IIUC.

---

<div class="post-metadata">

**Author:** ![kateinoigakukun](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kateinoigakukun/32/16706_2.png) [@kateinoigakukun](https://forums.swift.org/u/kateinoigakukun)\
**Post date:** [September 18, 2025, 2:21am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/19 "2025-09-18T02:21:59Z")

</div>

You can still use `wasm32-unknown-none-wasm` target for that purpose, although we don't actively support it

---

<div class="post-metadata">

**Author:** ![Max\_Desiatov](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/max_desiatov/32/20654_2.png) [@Max\_Desiatov](https://forums.swift.org/u/Max_Desiatov)\
**Post date:** [September 18, 2025, 7:11am UTC](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956/20 "2025-09-18T07:11:13Z")

</div>

> [@7ombie](#):
>
> Do I have to use WASI?

For any non-trivial code you'll have to use a libc (heap allocation, RNG etc). Pretty much everything in a libc, except heap allocation and maybe some formatting functions, has to be backed by host imports. You can spend time rolling your own libc and imports ABI, or can use readily available WASI 0.1 imports. We've chosen the latter as the default and officially supported approach.

Additionally, you don't pay for what you don't use with Embedded Swift. With full optimizations unused WASI imports are removed from the final binary, so If you need only a heap allocator and nothing else, you'll technically get a WASI-less binary even with a WASI triple.

[Next page](https://forums.swift.org/t/swift-for-wasm-q3-2025-updates/81956.md?page=2)
