Skip to content

Commit

Permalink
docs: mention wasm?init change from vitejs#8219
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed May 31, 2022
1 parent f1d8063 commit 5b62cb1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/guide/migration.md
Expand Up @@ -68,6 +68,21 @@ If using ESM for SSR isn't possible in your project, you can set `ssr.format: 'c
- When using an alias with `import.meta.glob`, the keys are always absolute.
- `import.meta.globEager` is now deprecated. Use `import.meta.glob('*', { eager: true })` instead.

### WebAssembly support

`import init from 'example.wasm'` syntax is dropped to prevent future collision with ["ESM integration for Wasm"](https://github.com/WebAssembly/esm-integration).
You can use `?init` which is similar to the previous behavior.

```diff
-import init from 'example.wasm'
+import init from 'example.wasm?init'

-init().then((instance) => {
+init().then(({ exports }) => {
exports.test()
})
```

## Migration from v1

Check the [Migration from v1 Guide](https://v2.vitejs.dev/guide/migration.html) in the Vite v2 docs first to see the needed changes to port your app to Vite v2, and then proceed with the changes on this page.

0 comments on commit 5b62cb1

Please sign in to comment.