Skip to content

Commit bcda294

Browse files
authored
blog: update Webpack 5.106 release notes to include source-phase imports for WebAssembly
1 parent 54e1847 commit bcda294

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

src/content/blog/2026-04-13-webpack-5-106.mdx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ contributors:
55
- bjohansebas
66
---
77

8-
**Webpack 5.106 introduces plugin validation hooks, built-in runtime style injection for CSS Modules, smarter tree shaking for CommonJS destructuring, and an experimental integration with `oxc-parser` for faster JavaScript parsing.**
8+
**Webpack 5.106 introduces plugin validation hooks, built-in runtime style injection for CSS Modules, smarter tree shaking for CommonJS destructuring, source-phase imports for WebAssembly modules, and an experimental integration with `oxc-parser` for faster JavaScript parsing.**
99

1010
Explore what's new in this release:
1111

1212
- [**Plugin Validation with `compiler.hooks.validate`**](#plugin-validation-with-compilerhooksvalidate)
1313
- [**CSS Modules with Runtime Style Injection**](#css-modules-with-runtime-style-injection)
1414
- [**Better Tree Shaking for CommonJS Destructuring**](#better-tree-shaking-for-commonjs-destructuring)
15+
- [**Source Phase Imports for WebAssembly (Experimental)**](#source-phase-imports-for-webassembly-experimental)
1516
- [**Getting Started with `create-webpack-app`**](#getting-started-with-create-webpack-app)
1617
- [**Context Support for VirtualUrlPlugin**](#context-support-for-virtualurlplugin)
1718
- [**Experimental JavaScript Parsing with `oxc-parser`**](#experimental-javascript-parsing-with-oxc-parser)
@@ -141,6 +142,38 @@ This also works with `module.require`:
141142
const { a, b } = module.require("./module");
142143
```
143144

145+
## Source Phase Imports for WebAssembly (Experimental)
146+
147+
Webpack now includes experimental support for TC39 [Source Phase Imports](https://github.com/tc39/proposal-source-phase-imports) when importing WebAssembly modules.
148+
149+
The proposal is currently at **Stage 3** and introduces a way to import a module at the _source phase_ instead of immediately evaluating it. In practical terms for WebAssembly, this means you can obtain a compiled `WebAssembly.Module` first, and instantiate it later with your own imports.
150+
151+
Enable the feature with `experiments.sourceImport`:
152+
153+
```js
154+
module.exports = {
155+
experiments: {
156+
asyncWebAssembly: true,
157+
sourceImport: true,
158+
},
159+
};
160+
```
161+
162+
Then use either static or dynamic source-phase syntax:
163+
164+
```js
165+
// Static form
166+
import source wasmModule from "./module.wasm";
167+
168+
// Dynamic form
169+
const wasmModule2 = await import.source("./module.wasm");
170+
171+
const instance = await WebAssembly.instantiate(wasmModule);
172+
```
173+
174+
You can also see an end-to-end example in webpack's repository:
175+
[https://github.com/webpack/webpack/tree/main/examples/wasm-simple-source-phase](https://github.com/webpack/webpack/tree/main/examples/wasm-simple-source-phase)
176+
144177
## Getting Started with `create-webpack-app`
145178

146179
[`create-webpack-app`](https://www.npmjs.com/package/create-webpack-app) is now the recommended way to scaffold a new webpack project. Previously, this functionality lived inside `webpack-cli` as the `webpack init` command, but it has been extracted into its own standalone package with the release of webpack-cli 7.

0 commit comments

Comments
 (0)