Skip to content

feat: unwasm (nitro) support#9

Open
pi0 wants to merge 1 commit into
remorses:masterfrom
pi0:feat/unwasm
Open

feat: unwasm (nitro) support#9
pi0 wants to merge 1 commit into
remorses:masterfrom
pi0:feat/unwasm

Conversation

@pi0
Copy link
Copy Markdown

@pi0 pi0 commented Jan 15, 2026

This PR adds unwasm support condition. Nitro uses unwasm for universal deployments, using wasm source and appropiate wrapper based on the deployment target.

Comment thread package.json
"bun": "./bun.js",
"workerd": "./cloudflare.js",
"edge-light": "./vercel.js",
"unwasm": "./unwasm.mjs",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Condition added after no-op environments and before the node that mainly needs takeover

Comment thread unwasm.mjs

import { HTMLRewriterWrapper } from './dist/html_rewriter_wrapper.js'

import wasm from './dist/html_rewriter_bg.wasm?module'
Copy link
Copy Markdown
Author

@pi0 pi0 Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: unwasm also supports ESM exports without ?module if there are import paths, this allows later leveraging tree-shaking if needed. Otherwise, this current syntax uses source module import to be initialized as module later without trying to parse .wasm file import/exports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant