/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
errors/proxy-dynamic-wasm-compilation.mdx
29 строк
879 B
Jiwon Choi
docs: Replace Middleware docs to Proxy (#84709)
17 окт 2025, 17:13
Не верифицирован
17 окт 2025, 17:13
71ce95d
Код
Авторство
О чём код?
--- title: Dynamic WASM compilation is not available in Proxies --- ## Why This Error Occurred Compiling WASM binaries dynamically is not allowed in Proxies. Specifically, the following APIs are not supported: - `WebAssembly.compile` - `WebAssembly.instantiate` with [a buffer parameter](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate#primary_overload_%E2%80%94_taking_wasm_binary_code) ## Possible Ways to Fix It Bundle your WASM binaries using `import`: ```ts filename="proxy.ts" import { NextResponse } from 'next/server' import squareWasm from './square.wasm?module' export default async function proxy() { const m = await WebAssembly.instantiate(squareWasm) const answer = m.exports.square(9) const response = NextResponse.next() response.headers.set('x-square', answer.toString()) return response } ```