You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/guide/features.md
+9-4
Original file line number
Diff line number
Diff line change
@@ -435,13 +435,13 @@ Note that variables only represent file names one level deep. If `file` is `'foo
435
435
436
436
## WebAssembly
437
437
438
-
Pre-compiled `.wasm` files can be directly imported - the default export will be an initialization function that returns a Promise of the exports object of the wasm instance:
438
+
Pre-compiled `.wasm` files can be imported with `?init`- the default export will be an initialization function that returns a Promise of the wasm instance:
439
439
440
440
```js
441
-
importinitfrom'./example.wasm'
441
+
importinitfrom'./example.wasm?init'
442
442
443
-
init().then((exports) => {
444
-
exports.test()
443
+
init().then((instance) => {
444
+
instance.exports.test()
445
445
})
446
446
```
447
447
@@ -461,6 +461,11 @@ init({
461
461
462
462
In the production build, `.wasm` files smaller than `assetInlineLimit` will be inlined as base64 strings. Otherwise, they will be copied to the dist directory as an asset and fetched on-demand.
463
463
464
+
::: warning
465
+
[ES Module Integration Proposal for WebAssembly](https://github.com/WebAssembly/esm-integration) is not currently supported.
466
+
Use [`vite-plugin-wasm`](https://github.com/Menci/vite-plugin-wasm) or other community plugins to handle this.
0 commit comments